JQuery JSONP cross domain call not doing anything -


whenever jsonp call through jquery page set (either locally or on server) silent treatment. firebug reports 200 ok , response looks ok. setup alerts boxes popup on success or failure neither appears. doesn't seem matter url use, nothing pops up.

but if use twitter json page success alert box appears expected there wrong response don't know what.

as experiment copied twitter json response , uploaded booroo.com domain. should identical, still nothing. set headers on response page "application/json" , utf-8 still nothing.

please help, i've spent day on , don't know else try.

$.ajax({   datatype: 'jsonp', //  url: 'http://booroo.com/json.asp?callback=?',   url: 'http://twitter.com/users/usejquery.json?callback=?',   success: function () {         alert("success");          },     error: function(x,y,z) {         alert("error"+x.responsetext);     }        }); 

the response json.asp file contains following classic asp headers , json response copied twitter (i've tried others without success either.)

<%@language="vbscript" codepage="65001"%> <% response.expires = 0 response.expiresabsolute = now() - 1 response.addheader "pragma","no-cache" response.addheader "cache-control","private" response.cachecontrol = "no-cache" response.contenttype="application/json" response.codepage = 65001  response.charset = "utf-8"  %>({"test_param":12345}); 

you're having issues because that's not how response looks :)

when specify jsonp or callback=? gets replaced, it's doing: ?callback=functioname, turns response this:

{"test_param":12345} 

to this:

functionname({"test_param":12345}); 

that's needed jsonp work. check out updated url see mean: http://twitter.com/users/usejquery.json?callback=functionname


Comments

Popular posts from this blog

ASP.NET/SQL find the element ID and update database -

jquery - appear modal windows bottom -

c++ - Compiling static TagLib 1.6.3 libraries for Windows -