I'm trying to parse out location data from XML that is passed back from Google. It currently parses the data correctly, the problem is that it grabs all of the matching tags, instead of just the first results set.
Here's an example of the output.
Here's the code I'm using to achieve this:
How would I change it so that it only grabs the data from the first set of results?
Here's an example of the output.
Here's the code I'm using to achieve this:
Code:
function(){ var url = 'http://maps.googleapis.com/maps/api/geocode/xml?address=NewBrunswick,NJ&sensor=false'; $.ajax({url: 'proxy2.php?url='+url, type: "GET", dataType: "text", success: function ($data) {$data = $($data); lat = ($data.find('geometry').find('location').find('lat').text()); long = ($data.find('geometry').find('location').find('lng').text()); }});});
Comment