Reputation: 47995
I need to do a JSONP call.
Ajax function call :
$.ajax({
url: myPath,
dataType: 'jsonp',
success: function(data) {
alert("hello");
}
});
getJSON function call :
$.getJSON(myPath + '&callback=prova?', function(data) {
alert("hello");
});
with getJSON (using &callback=prova for setting JSONP protocol) I get an error 200. .ajax() works as well. Why? I want to use getJSON here...
Upvotes: 4
Views: 849
Reputation: 2583
Try this
$.getJSON(myPath + '?callback=prova', function(data) {
alert("hello");
});
Upvotes: -1
Reputation: 1039220
You should use callback=?
and not callback=prova?
if you want your request to be treated as JSONP:
$.getJSON(myPath + '&callback=?', function(data) {
alert("hello");
});
Upvotes: 3