Is there a way without using a server proxy to perform a cross domain GET or POST request?
-
8jsonp - http://ajaxian.com/archives/jsonp-json-with-padding – Russ Cam Jul 07 '10 at 23:24
-
I should have clarified that my GET request's response is not JSON formatted, so I don't think $.getJSON works – Crothers Jul 07 '10 at 23:29
5 Answers
If you are with only the current day browsers and have control over the external domain, you can use Cross-Origin Resource Sharing [CORS]
Most people do not have that luxury so you either have to use JSON with Padding [JSONP] or you need to use a serverside proxy.

- 204,599
- 20
- 195
- 236
-
2Excellent answer. More info is available at [this stack-o question](http://stackoverflow.com/questions/5908195/jquery-and-cross-domain-post-requests); and also, [check this blog post out](http://www.nczonline.net/blog/2010/05/25/cross-domain-ajax-with-cross-origin-resource-sharing/); in addition, [this mozilla-developer-network article](https://developer.mozilla.org/En/HTTP_access_control) is excellent reading, with links to more resources. [edit]: Note that in order to enable CORS, the server-side script must reply with special headers. – David Nov 22 '11 at 15:27
Using YQL is an easy way of doing cross domain ajax. You can specify to have a JSON or XML object returned. IBM has a good tutorial: http://www.ibm.com/developerworks/web/library/wa-aj-jsonp2/index.html
Though just search for yql cross domain and it'll bring up numerous tutorials.

- 3,177
- 4
- 26
- 37
You could use Flash. Flash allows you to make a cross-domain request to another server provided that it serves a Flash cross-domain policy file (an XML file). So you will need administrative access to the other server in order to set that up.
If you think this option might be what you're looking for or you want to do SSL/TLS cross-domain, check out the opensource Forge project:

- 2,078
- 14
- 17
AJAX Cross Domain is a low-cost library that allows to perform cross-domain AJAX requests. http://www.ajax-cross-domain.com/

- 1,511
- 16
- 22
-
It would be great if the down-voters left comments so the public could be educated as to why this is a bad answer. – Ross Hambrick Apr 30 '12 at 18:44
-
1Yeah, please let me know as I've used this library in a couple of projects and haven't faced any issues. – Ivan May 03 '12 at 06:55
-
5