[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 at
http://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