I’ve been thinking for a while if there’s a way to get cross-domain AJAX (using XML, not JSON) to work. Can anyone see any reason why the following wouldn’t work:
- Create an iframe
- Load the URL of the AJAX call in the iframe
- Use JavaScript to get the content of the iframe
(this won’t be asynchronous, but could using setTimeout(functionToLoadTheIframe, 1) enable you to achieve asynchronicity?)
Yes you can use iframes for cross domain AJAX. It get’s a little complicated (more so if you want to use XML), but it is possible. Here’s a good article that describes several different hacks that are used. I think one is pretty similar to what you’re describing. More importantly he describes the rules on iframe to iframe communication which will probably help the most.
http://softwareas.com/cross-domain-communication-with-iframes