1

here's the ajax call

var url_map = "http://maps.googleapis.com/maps/api/geocode/json?latlng="+lat+","+lon+"&sensor=false?callback?";
$.ajax({
       type: "GET",
       dataType : "json",
       url: url_map,
       crossDomain:true,
       success: function(data){
          console.log("success");
       },
       error: function(e){
          console.log(JSON.stringify(e);
       }
)};

I tried jsonp,json as dataType. but it still call back the parsererror error. also tried to modify the url_map adding &output=json or/and removing the ?callback? parameter. is there a way to catch a detailed error instead a generic parsererror?

what's wrong with my code?

EDIT

in my opinion, it's not a duplicate of the link mentioned. I already have the lat and long. I need to get the country of that coordinates

Dario Rusignuolo
  • 2,090
  • 6
  • 38
  • 68

1 Answers1

0

as mentioned in the link below and in the comments, googleapis doesn't provide jsonp ajax requests anymore.

this solved my problem.

Community
  • 1
  • 1
Dario Rusignuolo
  • 2,090
  • 6
  • 38
  • 68