jquery - php and JavaScript zip code -
what i'm trying when user enters zip code in input type value of input type store in origin_zipcode add origin_zipcode inside $url variable. there should run xml , should able display city , state doesn't im trying make work like
when enter in zip code
$("#origin_zipcode").keyup(function(){ var origin_zipcode = $("#origin_zipcode").val(); <?php $url = "http://zipcodedistanceapi.redline13.com/rest/gnpsexsqyp3datlkfrb3d0v0mpvc3jjj6zmlwec54fie8ezowasabxaxn5zqpjav/info.xml/origin_zipcode/degree"; $xml = simplexml_load_file($url); $city = $xml->city; $state = $xml->state; ?> $(".labelzip").text(<?php echo $city,$state"; ?>); });
you can't send jquery variable php script unless refresh page using 1 of few possible methods. because while jquery client-side, php server-side. after php has finished loading page, can't used again without page reload.
you can @ these questions possible solutions:
Comments
Post a Comment