SeVir, Just a small note, this is cool for trusted requests which you initiate.
But IE 6.0 and Opera 9.10 doesn't like it. Should it work under IE and Opera? -- HLS On Aug 24, 8:16 am, SeViR <[EMAIL PROTECTED]> wrote: > [EMAIL PROTECTED] escribió:> I'm trying to get a json object from a > sub-domain but keep getting a > > error (cross-domain / cross-site scripting error). > > > Any ideas, can the $.ajax(properties) function handle jsonp? > > > A sample of my code can be viewed > > athttp://matthewmoore.info/jssamples/ajax-code.html > > > Thanks for your help in advance. > > > Matthew > > $.ajax is not cross-side domain, because XMLHttpRequest is not > cross-side domain. > You can use jsonp with: > > var script_call = document.createElement("script"); > script_call.type = "text/javascript"; > script_call.src = "http://sub.domain.tld/data?callback=mycallback"; > $("head")[0].appendChild(script_call); > > function mycallback(data){ > alert(data); //example > > } > > JSON RESPONSE IS: > mycallback( > { > jsondata: "somthing", > another: "ey" > } > ); > > Works for me, using Yahoo Services, Flickr, Amazon, .... Google API use > internally > the same. > > -- > Best Regards, > José Francisco Rives Lirola <sevir1ATgmail.com> > > SeViR CW · Computer Design > http://www.sevir.org > > Murcia - Spain