How to set up form action
I've been developing a web app on a single computer and have been using http://localhost:8080/myServlet in my form action field.
Now I'm trying to run my server on a remote machine and can get my web page to come up, but when I hit the Submit button, it tries to access the local host, not the host where the server resides. I'm sure that I can hard-code the name of the server instead of localhost, but what happens if the web app gets moved to a different server? I'd have to modify index.html to set the new name of the server.
How can I setup the action property such that it will access myServlet no matter the name of the server that it resides on?
var currentURL = window.location;
alert ( currentURL.host ); // Displays 'www.example.com:80'
That worked! Thanks!
Originally Posted by criterion9
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)