Hi, Using the ActiveXObject object on IE. How can I submit a cross-domain request?
+2
A:
Setup a server-side proxy to make the request for you. Then invoke the proxy (locally) using AJAX.
Josh Stodola
2009-03-22 17:36:55
A:
I would really recommend using a javascript framework when dealing with ajax request. That way you don't have to get into the intricaties of each browser. My personal favorite is jQuery: http://www.jquery.com/
Now, when it comes to cross-domain, you have two situations:
- Data is only available as XML => use a server-side proxy: http://ajaxpatterns.org/archive/Cross-Domain_Proxy.php
- Data can be retrieved as JSON using JSONP: http://www.ibm.com/developerworks/library/wa-aj-jsonp1/
Whenever possible, when it comes to a web browser, I'd recommend JSONP for its simplicity. However, things can get tricky in case of error so, again for jQuery, I'd recommend the following plugin: http://code.google.com/p/jquery-jsonp/
Julian Aubourg
2009-03-25 11:20:49