After dynamically changing a form submit function causes old function to get called once then new fu

Posted by cnobile on Stack Overflow See other posts from Stack Overflow or by cnobile
Published on 2010-03-25T00:29:52Z Indexed on 2010/03/25 0:33 UTC
Read the original article Hit count: 325

Filed under:
|

I am setting the submit function on a form with jQuery then later in the process I reset the function to something else. What happens is the original function gets called again then the new function when only the new function should have been called.

I am sending the requests with AJAX. The first one validated the values on the server then asks if you want to continue. Clicking the submit again should only call the changed function but for some reason both get called simultaneously with a single click.

What is happening here? Could jQuery be delaying the the setting of the 2nd function on the form submit?

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about jQuery