Prevent Reloading Page After Submiting Form. ( No Ajax )
I am new to JavaScript and jsp. I need to submit a form, which calculates some values from input fields and hide the div which contains the input fields after submitting. After su
Solution 1:
The simplest way by just looking at your code is to add a onsubmit="return false"
attribute to your form tag:
<formonsubmit="return false">
This will prevent the form from submitting AKA communicating with the server. You achieve the same result using DOM selectors in the javascript as well, which might be cleaner.
BTW you have some invalid markup in your form that might cause errors when traversing the DOM.
Solution 2:
Ok... solved the problem by handling everthing with jsp...
An easy if-else condition was enough to hide the first div and show the other by defining a boolean variable which is set to true, when the calculation is done...
thx anyway:D
Post a Comment for "Prevent Reloading Page After Submiting Form. ( No Ajax )"