Home >Web Front-end >JS Tutorial >The method of converting elements in the form into objects is suitable for form submission_javascript skills

The method of converting elements in the form into objects is suitable for form submission_javascript skills

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOriginal
2016-05-16 16:50:151451browse

复制代码 代码如下:

function serializeObject(form){
var o ={};
$.each(form.serializeArray(),function(index){
if(o[this['name']]){
o[this['name']] = o[this['name']] "," this['value'];
}else{
o[this['name']] = this['value'];
}
});
return o;
}
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn