我很困惑如何使用jQuery.validate插件访问提交的表单。jquery.validate插件访问ajax成功回调中的表单
在的API选项“成功”选项:http://jquery.malsup.com/form/#options-object
它说,在成功函数的第四个参数是jQuery的包装形式的对象,但我试图用jQuery访问它一直说其undefined
。
这里的成功,函数的样子他们的榜样页:http://jquery.malsup.com/form/#ajaxSubmit
function showResponse(responseText, statusText, xhr, $form) {
var id=$form.attr('id');
console.log('id:'+id);
}
不幸的是,执行console.log说:Uncaught TypeError: Cannot call method 'attr' of undefined.
有什么想法?
感谢, 添
我想你使用的jQuery <1.4,因为它在'()'中有一些注释,请参阅 – thecodeparadox
@thecodeparadox,谢谢我使用jQuery1.7.1。我看到那张纸条,但不知道我是否误解了一些东西。 –
@timpeterson它解决了吗? –