Here is my jQuery ajax
:-
function getlg(){ var cntry_code = 'IN'; var reg = 'Rajkot'; var xml; $.ajax( { url: "http://services.gisgraphy.com//geocoding/geocode?address="+reg+"&country="+cntry_code+"", async: false, dataType:'xml', success: function(data) { xml=data; } }); var lat = $(xml).find('lat:eq(0)').text(); alert(lat); var lng = $(xml).find('lng:eq(0)').text(); alert(lng); }
I am trying to pass in URL city name and country code and get xml
file. try jsfiddle :-http://jsfiddle.net/GbDFD/ From this xml
file i am try to get first lat
and lng
element value.
This is working url.
I am try to pass the city name and country code in ajax url its work but not return me latitude and longitude value.
how can it work using javascript.
thanks.