Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I just started using the mapQuest Geocoding API and I created a code for searching addresses. The following code alerts "OK" but I can not alert the (lat, lon) coords, even I tried with so many different ways. Can you spot what is wrong? Does this means that the coords are not actually returned? The alerts about the coords are not even alert "undifined"...


the code :

function codeAddress(){
    var ad = document.getElementById("address");//get input from form
                type: "POST",                
                url: "******&outFormat=json&inFormat=json&json={location:"+ad+",options:{maxResults:1}}",                                              success: function(response) {
                    alert("OK");//alerts OK, but NONE of the followinng


//this is the html form    
<input id="address" type="textbox">    
<input type="button" value="Encode" onClick="codeAddress()">  
share|improve this question

For Mapquest Geocoding you need to send the format

In the example given you get the full

Take this example and add YOUR_API_KEY{location:{street:%22Lancaster,PA%22},options:{thumbMaps:false,maxResults:1}}

You should be getting the flowing back

Country: US State: PA County: Lancaster City: Lancaster Response Code:A5XAX Lat: 40.03804 Lng: -76.30127

Note: Response Code:A5XAX shows the accuracy

thumbMaps needs to set to false - you only want the info - not the map.

share|improve this answer

The syntax should be like


It is that easy. I feel so humilated. I think I should stop coffee for a while...

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.