server side scripting in to javascript

ArmyMommy

New Member
i am try to get latitude and longitude value from ip address
after getting lat and lng value POST in to php file using AJAX and generate new xml file
this is my html file:-\[code\]<html xmlns="http://www.w3.org/1999/xhtml"> <head> <script type="text/javascript" src="http://j.maxmind.com/app/geoip.js" ></script> <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script> <script> function getlg(){ var lan=geoip_latitude(); var lng=geoip_longitude(); var gen = $('#Sex').val(); var date = $('#date').val(); $.ajax({ type: "POST", url: "http://localhost/SVN/trunk/home/url.php?lat="+lan+"&lng="+lng+'&radius'+$('#radius1').val(), contentType: "text/html", success: function(token) { }, error:function (xhr, ajaxOptions, thrownError){ alert(xhr.statusText); alert(thrownError); } }); } </script> <body><div id="region"><h5></h5></div>Enter Radius: <input type="text" id="radius1"></input><input type="button" id="filter"onclick="getlg()" value="http://stackoverflow.com/questions/15826085/Go"></body></head></html> \[/code\]
this is my php file:-\[code\]<?phpfunction convertNodeValueChars($node) { if ($node->hasChildNodes()) { foreach ($node->childNodes as $childNode) { if ($childNode->nodeType == XML_TEXT_NODE) { $childNode->nodeValue = http://stackoverflow.com/questions/15826085/iconv('utf-8', 'ascii//TRANSLIT', $childNode->nodeValue); } convertNodeValueChars($childNode); } } } $url='http://services.gisgraphy.com/geoloc/search?lat='.$_GET['lat'].'&lng='.$_GET['lng'].'&radius='.$_GET['radius']; $doc = new DOMDocument(); $doc->load($url); $doc->save('General.xml');?>\[/code\]in this file i am try to Get lat and long and radius from html ajax function and getting one new xml file with help of url.
but its take so much time if radius is biggest.
i want to try this php code in java script dont like server side scripting.
please help me out with this...
thanks...
 
Back
Top