> From: [EMAIL PROTECTED]
> 
> 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

Hi Matthew, I saw your comment over on my blog and answered it there too.

Just to elaborate, $.ajax() and related calls are subject to cross-domain
restrictions.

The whole purpose of the JSONP format is to get around this, by not using
AJAX at all. Instead, you use a dynamic script tag, so when the JSONP data
is loaded it automatically calls the callback function you have provided and
named in the URL.

If you have data available in JSONP format, you don't need to use AJAX to
download it; the dynamic script tag is all you need. There are a few rare
versions of Safari where this fails, but otherwise it works in all modern
browsers.

You can either use my JSON plugin, or similar code like José posted in his
reply.

See also the earlier comments on my blog post for some other insights:

http://mg.to/2006/01/25/json-for-jquery

BTW, do you have an actual URL where we can see the JSONP data you're
working with? That might be helpful if you have further questions.

-Mike

Reply via email to