Ok, so in order to get around cross-domain issues, you need to
dynamically load a javascript file which contains JSON formatted in
the JSONP standard and basically "out smart" the browser.

Do you know if there is a plug-in that works like the
$.ajax(properties) function but for cross-domains?

Matthew


On Aug 24, 6: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

Reply via email to