I am having a problem with jsonp and jquery.
This is my code -
var myCallback = function(data) { console.log(data); }; $.ajax({ url: my_url, type: 'GET', dataType: 'jsonp', jsonp: 'callback', jsonpCallback: 'myCallback' });
jQuery adds something like ?callback=myCallback&_=1340513330866 to my_url, and the data returned from my_url is myCallback('abcd') - although in fact it will return some HTML code instead of abcd .
Problem: abcd does not enter the console through myCallback . So what am I doing wrong? I got the impression that the returned data will be executed, since it is inside the script tags?
javascript jquery jsonp
user1437328
source share