I am g开发者_如何学运维etting an Invalid Error Label in my console error message.
My result.json file is in format like
{
"name": "Zara Ali",
"age" : "67",
"sex": "female"
}
and my code is like below from where i want to fetch above result.joson file
$(document).ready(function() {  
    //if submit button is clicked  
   $('#recaptcha_reload').click(function () { 
$.ajax({
dataType: "jsonp",
url: 'http://www.remoteserver.com/advertise_api/result.json?callback=?&rpp=50&q=mozilla',
jsonp: "$callback",
success: function(data){
alert("#");
},
error : function(XMLHttpRequest, textStatus, errorThrown) {
          alert("$$");   
        }
  });
});   
});   
What about this error ? Thanks
When requesting using JSONP, you have to return the data in JSONP format:
$callback({
"name": "Zara Ali",
"age" : "67",
"sex": "female"
});
The data will be executed when it arrives (as that is how JSONP works). If you don't put the object in a function call, it will be executed as if it was code, which is the reason for the error message. The brackets are interpreted as a scope block, and "name": is interpreted as a label, which is invalid because a label can't have quotation marks in the identifier.
 
         
                                         
                                         
                                         
                                        ![Interactive visualization of a graph in python [closed]](https://www.devze.com/res/2023/04-10/09/92d32fe8c0d22fb96bd6f6e8b7d1f457.gif) 
                                         
                                         
                                         
                                         加载中,请稍侯......
 加载中,请稍侯......
      
精彩评论