`
lizhuang
  • 浏览: 889271 次
  • 性别: Icon_minigender_1
  • 来自: 上海
社区版块
存档分类
最新评论

Chrome报表单提交错误,Form submission canceled because the form is not connected

阅读更多
之前在Chrome里运行正常的代码,Chrome升级到56后报表单提交错误:

Form submission canceled because the form is not connected
代码如下:

function submitData(name) {
  var form = $('<form method="post" action="updateName">'
                +'<input type="submit"/>'
                +'<input type="hidden" name="name" value="'+ name +'" /></form>');

  $('input[type="submit"]', form).click();
}
问题解决
原因

HTML标准规定如果form表单没有被添加到document里,那么form表单提交将会被终止。

参考:Form submission algorithm

在Chrome56之前的版本是不符合标准的,Chrome56修复了这个问题,让form表单提交符合标准要求:

参考:Chrome issue 2416033002

解决方法

解决方法就是把form表单添加到document后再提交:

jQuery

$(document).append(form);


document.body.appendChild(form);
分享到:
评论

相关推荐

    js-ajax-form-submission-源码.rar

    js-ajax-form-submission-源码.rar

    Document Submission Form 2018 (green).docx

    Document Submission Form 2018 (green).docx

    Ajax-Codeigniter-3-Ajax-Form-Submission.zip

    Ajax-Codeigniter-3-Ajax-Form-Submission.zip,“codeigniter 3 ajax表单提交和验证教程”一集的源代码,ajax代表异步javascript和xml。它是多种web技术的集合,包括html、css、json、xml和javascript。它用于创建...

    asp.net mvc

    The default is that every button in a form causes validation logic to run, and if validation fails, the validation logic blocks submission of the form. Enabling validation selectively for buttons ...

    form-create:强大的动态表单生成器|form-create is a form generation component that can generate dynamic rendering, data collection, verification and submission functions through JSON

    形式创造 form-create是一个表单生成组件,可以通过JSON生成动态呈现,数据收集,验证和提交功能。 支持3个UI框架,并支持生成任何Vue组件。 内置20种常用的表单组件和自定义组件,无论如何轻松地处理复杂的表单。...

    AVG 破解版

    3. The Licensee shall immediately inform the Licensor in written form on any use of third parties and any circulation providing the third party's statement of submission under the provisions of the ...

    初赛2月份25.4分-提交结果文件-submission.csv

    第四届工业大数据创新竞赛-水电站入库...初赛线上第一段2月份25.4分,第二段最高分10.0分,第三段不好意思说,可看文章末尾我的提交结果记录,第一次9月8号提交第六名,当时开心的要死,之后排名一路下降,大佬们太强了

    Sakemail

    He also send me a nice patch, so the bug is fixed.- Craig Manley added a ExtraHeaders property, please, use with care, it‘s just not valid to put inside it whatever thing.- The CC header was not ...

    Form-Submission-Attributes-Polyfill:简单的polyfill处理旧版浏览器中的html5表单提交属性

    表格提交属性填写 简单的polyfill处理旧版浏览器中的html5表单提交属性 函数必须应用于表单,即$('form')。formSubmissionAttributes(),否则它将输出警告并取消对该元素的执行。 该脚本将从表单内部或通过form...

    submission (1).csv

    训练结果

    js-ajax-form-submission:有关使用AJAX提交HTML表单的教程。 影片连结

    js-ajax-form-submission 有关使用AJAX提交HTML表单的教程。 视频链接:&lt;即将推出&gt;

    Struts2上传所需jar包

    form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For...

    struts1.3.9.zip

    form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For...

    article submission

    &lt;a href="http://www.rankexperts.com"&gt;article submission&lt;/a&gt; , &lt;a href="http://www.rankexperts.com"&gt;article submission service&lt;/a&gt; , &lt;a href="http://www.rankexperts.com"&gt;build backlinks&lt;/a&gt; , ...

    Titanic数据集(gender_submission,test,train)

    泰坦尼克号数据集,官网下载(gender_submission,test,train),一共三个

    hash table spell checking

    Goals: This assignment is designed to reinforce the student's understanding of the use of hash tables as searchable containers. Outcomes: Students successfully completing this assignment would master...

    titanic.ipynb

    If the age is estimated, is it in the form of xx.5 sibsp: The dataset defines family relations in this way... Sibling = brother, sister, stepbrother, stepsister Spouse = husband, wife (mistresses ...

    Form Submission with a new Sheet-crx插件

    语言:English (United ...此加载项的主要目的是使用相同的Google表单和Google单,以自动将条目添加到新标签中,每一个... 此加载项的主要目的是 使用相同的Google表单和Google Shoto每天自动将条目添加到新选项卡。

    数据结构作业Hash表

    Goals: This assignment is designed to reinforce the student's understanding of the use of hash tables as searchable containers. Outcomes: Students successfully completing this assignment would master...

Global site tag (gtag.js) - Google Analytics