JSONP callback method is not defined

Posted by Micah on Stack Overflow See other posts from Stack Overflow or by Micah
Published on 2010-06-09T19:00:29Z Indexed on 2010/06/09 19:02 UTC
Read the original article Hit count: 796

Filed under:
|
|
|

I'm trying to get a jsonp callback working using jquery within a greasemonkey script. Here's my jquery:

$.ajax({
    url: "http://mydomain.com/MyWebService?callback=?",
    data: { authkey: "temphash" },
    type: "get",
    dataType: "json",
    cache: false,
    success: function(data) {
        console.log(data);
    }
});

in my webservice (asp.net) I'm returning the response with a content type of application/javascript. The response the server is actually sending back is:

jsonp1276109314602({"message":"I'm getting tired of this not working"})

The jsonp1276109314602 method name is being randomly generated by jquery, and I'm grabbing it with Request.QueryString["callback"]

However my success function is never called and the firebug console gives me an error saying jsonp1276109314602 is not defined.

What am I doing wrong?

© Stack Overflow or respective owner

Related posts about ASP.NET

Related posts about jQuery