PDA

View Full Version : Cross domain AJAX


Adam_C
12-13-2010, 08:55 PM
Hi, I have a basic understanding of AJAX and how to use it, however I have searched the internet and read on some stuff of how to use cross domain AJAX but to me it's not making sense, can someone please explain what it does and how I would use cross domain AJAX to access a feed such as BBC News (http://feeds.bbci.co.uk/news/rss.xml) and what would be the best way and why?

I know it's a lot to ask but thanks in advance :D

edbr
12-14-2010, 12:43 AM
you need a feed reader, heres a tut
http://ajax.phpmagazine.net/2005/11/ajax_rss_reader_step_by_step_t.html

ranjan
12-14-2010, 03:44 PM
Cross domain ajax is not supported by browsers because of security risks (remember you can, not just GET but also POST with ajax)

As such a few techniques have evolved for GETting AJAX across domains:

1. JSONP
2. Using a proxy (flash proxy, YQL or your own server side asp, php, etc script)

Problem with JSONP is that the server hosting the data should allow JSONP request (eg. Twitter API returns data as JSONP)

BBC feeds (RSS) has to be first fed to your proxy since there is no JSONP available.

YQL maybe the easiest solution to implement more details at http://developer.yahoo.com/yql/