before a submit-action is fired i´m doing a little check before:
$(document).ready(function(){
$("#submit").submit(function(e){
e.preventDefault();
var check = $("#check").val();
if(check == 1) {
$("#submit").submit();
} else {
alert"input-hidden value is wrong")
}
}
});
});
So i am checking if a value of a input-hidden-value is set to 1.
If it is, the form action should be processed, but instead i get this error:
too much recursion
anybody could help with this?
EDIT:
In this line:
$("#submit").submit();
this part:
#submit
is underlined, why?
It is because calling
$("#submit").submit();
again triggers the submit event which will again invoke the submit handler thus creating an infinite recursive loop... call the dom elements submit method instead likethis.submit()
or use the preventDefault() only if the value is invalid else allow the default action to continue