2

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

3
  • 3
    Just don't set the jsonpCallback option. Does the server always return the response in that format, calling a jsonp function? Commented May 21, 2013 at 15:55
  • 1
    Got the answer! I have to set but not to callback. Instead I have to put jsonCallback: "jsonp" because is the default callback from the proxy im using. Commented May 21, 2013 at 16:00
  • Can you please post your solution as an answer and mark it as accepted? Commented Jul 27, 2013 at 19:23

2 Answers 2

2

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.

Sign up to request clarification or add additional context in comments.

Comments

0

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.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.