【问题标题】:How to get form Element back in success from AjaxForm?如何从 AjaxForm 成功获取表单元素?
【发布时间】:2015-08-15 07:49:43
【问题描述】:

我使用 AjaxForm 处理表单。

在“成功”中,我需要取回我的表单字段之一。成功的命令在作者页面上有此信息:

成功 表单提交后调用的回调函数。如果提供了“成功”回调函数,则在从服务器返回响应后调用它。它传递了以下参数:

    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)

现在最后一个是$form,据说里面有所有的表单元素。如何在变量中获取一个特定的表单元素,以便可以使用它?我不明白 jquery 包装的表单元素是什么意思。

我使用的插件是这样的:

http://malsup.com/jquery/form/#options-object

【问题讨论】:

    标签: jquery forms ajaxform ajaxsubmit


    【解决方案1】:

    完整回调函数的第三个参数应该包含对元素的引用:

    {
       ...
       complete: function(xhr, msg, el) { ... }
       ...
    }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多