You can't do a cross-domain POST, nor a cross-domain GET either. It doesn't
matter what kind of data it returns, you can't do a POST at all. It's not a
jQuery limitation; the browser won't allow it for any JavaScript code.
Cross-domain JSONP works because it uses a dynamic script element, not a GET
or POST.
-Mike
On Fri, Jan 15, 2010 at 5:14 PM, David P dpio...@gmail.com wrote:
I have a webservice sitting on my https server that accepts the POST
verb and responds with some JSON.
If I build a simple html form like
form method=post action=https://myserver.com/myWS;
input type=submit/
input type=hidden name=emailAddress value=a...@a.com /
input type=hidden name=password value=uk /
/form
it will return the correct json data, with content type application/
json, and the browser will ask to save the result. When I look at the
data it is 100% correct
if I try to access it with jquery using
$.post(https://myserver.com/myWS;, { emailAddress: a...@a.com,
password: uk }, function(data) { alert(hi!); }, json);
the call back will never execute. When I check firebug, in the net
panel, I can see the call go out (first the OPTIONS call which
completes successfully, then the POST) however I cannot view the
actual results. In the Console panel, the call is in red so firebug
thinks there is some kind of error.
Is there something I'm missing with how to handle cross domain POSTs
that return json data?