Hi, Using the ActiveXObject object on IE. How can I submit a cross-domain request?
-
Setup a server-side proxy to make the request for you. Then invoke the proxy (locally) using AJAX.
-
This may help http://www.mootools.net/docs_rc1/more/Request/Request.JSONP http://ajaxian.com/archives/jsonp-json-with-padding
-
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/
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.