I have the following jquery ajax request:
jQuery.ajax({
url: serverAddress+'php/product.php',
type: 'GET',
jsonpCallback: "callback7",
dataType: 'jsonp',
data: sendInfo,
success: function(result)
{
alert(result);
//do something
},
error:function(jqXHR,msg,errorThrown){ alert(msg+" : "+errorThrown);}
});
on the server side the script is:
$callback = $_GET['callback'];
//do something
$result = //something
echo $callback.'('.json_encode($result).')';
I get the following error from the ajax call:
parseerror : callback7 was not called
I looked up this error but couldn't find anything relevant, either in SO or in google... Hope you can help me. Thanks!
EDIT: I eventually solved the problem by transforming it into a regular json request. I'll be happy to know what could be the problem ans solution nevertheless.
Try adding these name value pair as jsonp:false & crossDomain:true in your js file. And in your server side remove the line $_Get['callback'] and add echo $callback.'('.json_encode($result).')' and alse set $callback='callback7'
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.