Hi, I use AJAX to load an external HTML file, containing a form, into another HTML file. The form HTML looks something like this:
<form id="..." name="..." onsubmit="postUsingAJAX(x,y,x); return false;">
Loading works fine. However, the onSubmit code is not executed when the form is submitted, same thing with onClick handlers on the submit button; no event listeners seems to be triggered. Is this the way things work when HTML is loaded through AJAX or am I doing something wrong?
A possible work-around would be to do
theFormObject.addEventListener('submit', function...)
but I can't figure out how to make the form NOT submit after the callback is fired. How can I make it wait for a return value (or rather, feed it "return false" no matter what happens in the callback function)?
Any ideas?