I found lots of answers regarding AJAX calls, but I had trouble finding an answer for just a straight up 开发者_开发知识库HTML form without using Javascript.
Can you post a form from foo.mydomain.com/somepage
to bar.mydomain.com/someotherpage
?
I found lots of answers regarding AJAX calls, but I had trouble finding an answer for just a straight up HTML form without using Javascript.
Sure. You can post forms wherever you want, including other domains, ports, and even protocols.
The only thing you can't do is submit a form pointing to a different domain, port or protocol into an iframe, and then try to access its contents using JavaScript. That gets blocked by the Same Origin Policy (this can be overcome for subdomains though I think). Other than that, forms have no restrictions.
Just use an include the hostname in the action
attribute.
<form action="//bar.example.com/someotherpage" method="post">
精彩评论