Akash
Akash

Reputation: 367

ReferenceError: jsonp not defined

So I am making an ajax request in jquery like this:

$.ajax({
        url: url,
        dataType: "jsonp",
        jsonpCallback: 'callback',
        success: function(data) {
            alert(data.success);
        }
    });

This is what I want to receive from the url:

jsonp({
"success": true,
}
)

But I keep getting this error - ReferenceError: jsonp is not defined

what am I doing wrong ?

Thanks.

P.S: Testing on FF

Upvotes: 2

Views: 8050

Answers (2)

Eagle
Eagle

Reputation: 217

I was getting "jsoncallback is not defined " message in a cross domain ajax call.
After a lot of search I found like adding jsonpCallback: 'jsonCallback' gave me response as an object.

Upvotes: 0

Akash
Akash

Reputation: 367

After a whie I got the solution: instead of setting the jsonCallback : "callback" I changed it to

jsonCallback: "jsonp"

Because that is the default callback my proxy returns.

Upvotes: 2

Related Questions