DantheMan
DantheMan

Reputation: 7417

javascript send POST request to remote server

If I have a server on xyz.com and wanted to send a POST request via javascript to abc.com how do I do this? Will I run into the Same Origin Policy? Mainly I just need to send data and not necessarily return data (although that would be nice). Any thoughts on this view? I am ideally looking for an entirely javascript method. Thanks.

Upvotes: 0

Views: 851

Answers (1)

epascarello
epascarello

Reputation: 207537

If you want to post data, guessing you do not want to refresh the page. That means you need to add a hidden iframe to the page with a id/name. Set the form's target to that id/name and presto, you submit the form to that domain without refreshing the page.

Upvotes: 1

Related Questions