Cross-domain requests are not directly allowed. However, there is a generally accepted JSONP method that will allow you to avoid this restriction using script tags. Basically, you create a callback function with a known name:
function receiveData(data) {
And then your server wraps JSON data in a function call, for example:
receiveData({"the": "data"});
And you βcallβ the cross-domain server by adding a script tag to your page. jQuery elegantly wraps all of this in its ajax function.
Another method that I should have used from time to time is cross-documenting through an iframe. You can have one dialog with another, even cross-domain, with limited access through postMessage . Please note that only the latest browsers have this functionality, therefore the option is not viable in all cases, without resorting to hacking.
Jacob source share