Blogger Information
Blog 33
fans 0
comment 2
visits 41995
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
Ajax Post方式提交表单错误一例
hanyufeng的博客
Original
796 people have browsed it

网页中添加input 按钮

<input  type="button" id='btnSubmit' value="提交">

绑定onclick() 事件,使用Ajax对象以post方式提交表单,提交前使用serialize()序列化数据:

……
var data = serialize(document.forms[0])
xhr.send(data)

提交不成功,浏览器提示:

Uncaught ReferenceError: serialize is not defined

反复检查各部分代码,最后发现只要button按钮就可以:

<button id='btnSubmit'>提交</button>


不知道这是一个bug呢,还是另有原理可分析?

Statement of this Website
The copyright of this blog article belongs to the blogger. Please specify the address when reprinting! If there is any infringement or violation of the law, please contact admin@php.cn Report processing!
All comments Speak rationally on civilized internet, please comply with News Comment Service Agreement
1 comments
PHP中文网 2017-12-16 23:31:30
加油
1 floor
Author's latest blog post
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!