Submit Html Form, Perform Javascript Function (alert Then Redirect)
I have a JavaScript function that works great when I call it through an 'onClick' method. Basically what it does is pull data from a html form, and then based on that data, redirec
Solution 1:
You need to prevent the default behaviour. You can either use e.preventDefault()
or return false;
In this case, the best thing is, you can use return false;
here:
<formonsubmit="completeAndRedirect(); return false;">
Solution 2:
Looks like your form is submitting which is the default behaviour, you can stop it with this:
<formaction=""method="post"onsubmit="completeAndRedirect();return false;">
Post a Comment for "Submit Html Form, Perform Javascript Function (alert Then Redirect)"