I’m confused on how to access the submitted form using the jQuery.validate plugin.
In the “success” option of the API options: http://jquery.malsup.com/form/#options-object
it says that the 4th parameter in the success function is the jquery wrapped form object but my attempts to access it with jQuery keep saying its undefined.
here’s how the success function looks on their examples page: http://jquery.malsup.com/form/#ajaxSubmit
function showResponse(responseText, statusText, xhr, $form) {
var id=$form.attr('id');
console.log('id:'+id);
}
unfortunately, console.log says Uncaught TypeError: Cannot call method 'attr' of undefined.
any thoughts?
thanks,
tim
I solved this problem by explicitly writing out the jQuery form selector every time and not trying to pass it as an object.
So rather than trying to pass around
$formI used this:It is more verbose but at least it works!