I’m not sure why. I think it started when I incorportated jQuery’s .validator.
The website: http://friendswithwheels.herokuapp.com
The javascript:
$('#newLender').validate({
rules: {
fee: {
required: true,
number: true,
},
email: {
required: true,
isYaleEmailAddress: true,
}
},
errorPlacement: function (error , element) {
error.addClass("errorMessage");
error.insertAfter(element);
},
submitHandler: function (form) {
$('#newLender').submit( ajaxPostForLenders ); //ajaxPostForLenders submits the request
}
});
This question here will answer your question:
Need to press submit twice for submitting a form with ajax (jquery validation plugin)
I am not going to copy and paste their answer as it’s their work. But, feel free to accept my answer.
Cheers
Matt