title: check if ajax request is empty
body: <p>I use the free geocoding API of mapquest</p>
  
  <p><strong>I want to check if the request is sucessfull, but returned no data.</strong></p>
  
  <p>I type "vdfsbvdf54vdfd" (just a silly string) as adress in a form field. 
  I expect an alert like so "Sorry, wrong input". Alert never happens.</p>
  
  <p>This is my code snippet</p>
  
  <pre><code>$.ajax({
       type: "POST",
       url: "`http://open.mapquestapi.com/geocoding/v1/address?key=012`",
       data: { location: ad, maxResults: 1}
       })
  
  
   .done(function( response ) {alert(response);
           var geoclng = response.results[0].locations[0].latLng.lng;
          var geoclat = response.results[0].locations[0].latLng.lat;
  
          if (geoclng=="") {alert("Sorry, wrong input");}
  
           //now use lon/lat on map etc
                            )}
  </code></pre>
  
  <p>I tried <code>if (geoclng=="") {alert("Sorry, wrong input");}</code></p>
  
  <p>also <code>if (response.length=0) {alert("Sorry, wrong input");}</code></p>
  
  <p>and also <code>if ($.isEmptyObject(response)) {alert("Sorry, wrong input");}</code></p>
  
  <p>and alert never happens. </p>
  
  <p>If it helps, when I alert the response I get <code>object Object</code>. </p>
  
  <p>Thanks in advance </p>