George
George

Reputation: 224

How to get ajax response from other domain?

Except YQL ,Is there any way to get ajax's response and data from other domain without modifying server side's code?

YQL has limit (1000 calls per hour) for free user , but most of people said it's actually less.

Upvotes: 1

Views: 379

Answers (3)

Joseph
Joseph

Reputation: 119847

If what you mean by "without modifying server side's code" is not modifying the server of the data source, then you can have your own proxy server (basically making your own YQL server) to read the remote data. This is possible because the server-side is not bound to the Same-Origin Policy.

So you can AJAX your server, then let your server read the remote server using some form of wget, curl or fopen, and return what was retrieved:

Remote server <- fopen, curl or wget -> your server <- AJAX -> browser

Upvotes: 3

Kishore
Kishore

Reputation: 1912

You can use the iframe receiver pattern. It's an old technique. See Secure Cross-Domain Communication in the Browser by Danny Thorpe on MSDN. You dont have to use JSONP but still can make cross-domain calls

Upvotes: 1

emphaticsunshine
emphaticsunshine

Reputation: 3775

You can use a HTML 5 feature which is postMessage to do cross domain calls. Again it is not supported in all the browsers. Look at the following link for implementation: Cross domain call using postMessage

Upvotes: 1

Related Questions