Javascript 传递原始表单的jQuery表单插件

Javascript 传递原始表单的jQuery表单插件,javascript,jquery,jquery-forms-plugin,Javascript,Jquery,Jquery Forms Plugin,我正在使用并试图找出为什么不能在success函数中使用find方法 $('#signup-form').ajaxForm({ beforeSubmit: function (arr, $form, options) { $form.find("input[name=email]").css('width', '170'); $form.find("input[type=submit]").v

我正在使用并试图找出为什么不能在success函数中使用find方法

           $('#signup-form').ajaxForm({
           beforeSubmit: function (arr, $form, options) {
               $form.find("input[name=email]").css('width', '170');
               $form.find("input[type=submit]").val('Subscribing...').attr('disabled', 'true');
           },
           target: "#signup-form-wrap",
           dataType: 'json', 
           success: function (data, $form) {
               $form.find("input[type=submit]").val('Go!').css('width', '200');

           }
       });
出于某种原因,我得到了以下错误:

未捕获类型错误:对象成功没有方法“find”

当我提醒$form时,它的值只是字符串“success”。但是,它在beforebrimit中确实有效。我做错了什么?

根据示例,传递给success函数的第二个参数是statusText,听起来像是您正在记录的内容。以下是根据文档传递给success函数的参数:

1.) responseText or responseXML value (depending on the value of the dataType option).
2.) statusText
3.) xhr (or the jQuery-wrapped form element if using jQuery < 1.4)
4.) jQuery-wrapped form element (or undefined if using jQuery < 1.4)

从jQuery表单插件文档:

成功

$('#signup-form').ajaxForm({
  beforeSubmit: function (arr, $form, options) {
    $form.find("input[name=email]").css('width', '170');
    $form.find("input[type=submit]").val('Subscribing...').attr('disabled', 'true');
  },
  target: "#signup-form-wrap",
  dataType: 'json', 
  success: function (data, statusText, xhr, $form) {
    $form.find("input[type=submit]").val('Go!').css('width', '200');
  }
});
提交表单后要调用的回调函数。如果提供了“success”回调函数,则会在服务器返回响应后调用该函数。将以下参数传递给它:

1.)responseText或responseXML值(取决于数据类型选项的值)。
2.)状态文本
3.)xhr(如果使用jQuery<1.4,则使用jQuery包装的表单元素)
4.)jQuery包装的表单元素(如果使用jQuery<1.4,则未定义)

默认值:null

根据这些信息,您可能希望尝试以下操作:

*注意发送到success的参数的更改

$('#signup-form').ajaxForm({
  beforeSubmit: function (arr, $form, options) {
    $form.find("input[name=email]").css('width', '170');
    $form.find("input[type=submit]").val('Subscribing...').attr('disabled', 'true');
  },
  target: "#signup-form-wrap",
  dataType: 'json', 
  success: function (data, statusText, xhr, $form) {
    $form.find("input[type=submit]").val('Go!').css('width', '200');
  }
});

非常快。时限到了我就接受。谢谢:)@bob_cobb我很乐意。谢谢,我很感激!