I\'m creating a registration form for a client for an event they\'re hosting. The basic user details are submitted to a third-party system (ie name, email etc.) but the rest
try unbinding submit event on your success: method of your ajax call by calling unbind
$('#form1').unbind('submit');
$('#form1')[0].submit(); // call native submit
http://api.jquery.com/unbind/
Do you have a reason to have to utilize the submit
-method? The reason it enter an infinite loop is because it invokes the same submit event listener again.
If not, you can just queue two ajax-submits, one to the e-mail page, and again to the client.
Finally, you can unbind the event listener. A little known way to unbind an event listener is to pass in the event object to the unbind
-call. This will unbind only the current event listener:
$('#form1').submit(function(e){
if(myvalidator.isValid()){
$form = $('#form1');
$.ajax({
data: $form.serialize(),
type: "POST",
url: "email_send.asp",
success: function(){
$form.unbind(e).submit();
}
});
}
return false;
});