Skip to content
Advertisement

On form submission I get an error ‘Method not allowed’ – Javascript [closed]

I have below html and javascript but on form submission I get an error Method not allowed though I would like to stay on the same index.html and show the success message.

I have debugged the javascript and it bypasses the if condition even I put valid info.

index.html

JavaScript

javascript.js

JavaScript

Advertisement

Answer

You need to add action tag to your form. Like this:

<form method="post" name="FrmEnquiry" id="FrmEnquiry" onsubmit=" return sendEnquiryform();" action="">

You can add the value where you want to send the post to.

Also refer to: https://www.w3schools.com/tags/att_form_action.asp

User contributions licensed under: CC BY-SA
10 People found this is helpful
Advertisement