In addition to the JSONP option, you could also use a Web Proxy. This
is simply a server side script that sits on your domain. It takes the
POST from your domain, repackages it, POSTs it to the secondary domain
and sends the response back to the browser.

http://yourdomain.com/yourform.html
POSTs to -->
http://yourdomain.com/webproxy.php
POSts to -->
http://externaldomain.com/somescript
responds back to
http://yourdomain.com/webproxy.php
responds back to
http://yourdomain.com/yourform.html

If you're working with PHP you'll probably use curl. I've gotten this
to work on my site with the jquery validation and form plugins. It's
not too complicated.

Kurt

On Jan 16, 2:14 am, 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?

Reply via email to