0

Hell I have a form on my page that I submit it using JavaScript:

document.getElementById("contactForm").submit();

But this command redirects the page to the form action's page. and I don't want this to happen and stay on the page.

Please help me to solve this problem

(also I've googled it up but there were no useful information)

Ahmad Ameri
  • 144
  • 1
  • 1
  • 14

1 Answers1

1

Submitting sends you to the URL specified in the ACTION of the form via POST. This is not a redirect.

If you want to stay on the same page, use AJAX techniques, or post the form for a hidden Iframe.

Diodeus - James MacFarlane
  • 112,730
  • 33
  • 157
  • 176