0

I want to post a form to a remote server with ajax, the user shall not leave the website.

<form action="http://www.remoteserver.com/process.php">
  ...
  <button type="button">send</button>
</form>

Is that possible, with no restrictions compared to self-hosted files in terms of getting the response, etc.?

Paul Roub
  • 36,322
  • 27
  • 84
  • 93
Email
  • 2,395
  • 3
  • 35
  • 63
  • It's certainly possible if you send the form with ajax to your own server first, then use PHP to post the form to the remove server etc. – adeneo Dec 27 '14 at 14:48
  • @musa alexander hakre and hoanghieu the emphasize is on REMOTE server. i am starting to hate SO because of such people here. – Email Dec 27 '14 at 15:10
  • @adeneo yes, but directly not possible? this question and the duplicate issue raised by musa and alexander made me know that from now on i don't stackoverflow anylonger. its just about flag'in even wrongly to increase their points. the truth and solution are tertiary. hate it. – Email Dec 27 '14 at 15:24
  • I'll reopen that, as this is not about just submitting a form with ajax, but doing it to a remote server. Of course there's probably no way to do `application/x-www-form-urlencoded` request cross-domain from the clientside to another server, but it's still not a duplicate. – adeneo Dec 27 '14 at 15:48
  • Short answer: yes, somewhat, *if* the remote supports JSONP or Access-Control headers. So, "no" on the "No Restrictions" part. Not wanting to incur your wrath, I'll just note these related questions, which are pretty close to duplicates: http://stackoverflow.com/questions/3897641/can-ajax-request-data-from-a-remote-server, http://stackoverflow.com/questions/18817863/send-data-to-remote-server-with-jquery-ajax, http://stackoverflow.com/questions/13824941/jquery-ajax-post-request-to-remote-web-service. BTW, closing/flagging doesn't earn points. – Paul Roub Dec 27 '14 at 16:01

0 Answers0