2009/12/10 Kyle Decot <ow...@affinityskateboards.com>
>
> How do i make a ajax call using $.ajax(); to a subdomain on my
> website. I'm calling $.ajax() from www.example.com & the url for the
> call is api.example.com Thanks for any information you can provide me
> with.

You can use JSONP (JSON with Padding, JSON with Callback or whatever
it's called these days) to work around the Same Origin Policy if you
want to access data from another domain.

See: http://docs.jquery.com/Ajax/jQuery.getJSON
There's an example on how to use api.flickr.com.

jQuery will handle the padding automatically for you. You only have to
make sure that your script returns JSONP, eg.

callback(<JSON data>);

where "callback" is a string specified in the URL and <JSON data> is
just, well, JSON data.

Rafał Pocztarski

Reply via email to