The cause could be the javascript code has to be uploaded with its html contenent. If it's loaded before with another content, it does not work . Unless it's loaded again with the new content. With ajax, we can load a different content into the same page, but javascript code has to be reloaded again with the new contenet or it does not work. That causes the same code being loaded again and again. When it's loaded twice, and when a sumit is clicked, it's triggered twice. When it's loaded three times, it's triggered three times of the same code.
Question: does javascript code has to be loaded with content? Or it will not work. How to overcome this reloaded javascript requirement?
I may need to give you some context to understand the issue:
In the web page, there is navigation menu on left and a content panel on right. When you click on the left menu, the right content panel will change to its associated form. In the form, you use ajax to interact with server through javascript code. The javascript code is in an external file for handling all, including menu items. When content panel is changed by a click of the menu, the form submit will not work if the javascript code is not reloaded with the form. So the js code is included as part of the content panel. But the problem is when js code is reloaded twice, it triggers ajax call twice of the same action.
The question is how to avoid triggering the same ajax call more than once.
Bookmarks