Reputation: 5525
I have this simple html form :
<form action="../../process.php" method="POST">
----SOME INPUT HERE----
<input type="submit" value="Submit">
</form>
and that form located under this folder : /public_html/userweb/subdomain.domain.com/form.php while the process.php is located under /public_html folder.
the problem is... /public_html/userweb/subdomain.domain.com is actually a sub-domain's root folder and /public_html is the TLD's root folder.
my question is can a HTML form submission in sub-domain process by TLD? if so, how to do it? because that form always search process.php under subdomain.domain.com/process.php not domain.com/process.php
Upvotes: 0
Views: 600
Reputation:
AJAX it to the domain you want to send it to, and send it as jsonp
.
Edit: I was thinking of the Same Origin Policy, where you are restricted in what datatypes you can transmit cross-domain.
Upvotes: 1
Reputation: 31641
A form action can be any url. For example, this form submits a search query to google:
<form action="http://www.google.com/">
<p><input name="q"></p>
</form>
To do what you describe, just use a full url as your action
, such as //domain.com/process.php
Upvotes: 3
Reputation: 160893
The action
of the form
could be any URL, but not the path in the server.
You just need to set the action like:
<form action ="//domain.com/process.php" method="post">
Upvotes: 2