Cross Domain jQuery AJAX Calls with YQL

Recently i had to make client side ajax call to fetch data for domain other then my on and got this ugly error:


"Origin .... is not allowed by Access-Control-Allow-Origin."

It is because web browsers do not allow web pages to make cross-domain Ajax calls for security reasons.

I came across this cool post  that has cool approach to this situation, just add this jquery code

to your project and start ajaxing like that:



    url: 'http://.....',
type: 'GET',
: function(res) {
data = $(res.responseText).text();
//some code here..