Reputation: 19
This is my HTML named Week7.html, it results in a form like this https://gyazo.com/bd778ddcbb1a01374a37dd0605d13797
Upvotes: 2
Views: 76
Reputation: 4956
Your Javascript and DOM state gets lost when you submit the form (you're doing a regular submit, not an AJAX submit). Form submission triggers a new request, resulting in a new page. When the new page loads, you can only access whatever DOM is defined in that HTML file, from your JS. Since your processForm.html (by itself) does not have any form element called orderForm
, none of the JS can work.
You could perhaps redesign this to do the calculation in the server and return the total alone in processForm.html
.
Also, <script type="text/javascript" src="processForm.html">
does not include the file. It needs to be a .js file.
Upvotes: 2