12月6号,jQuery 序列化form

var submitform = $('#SearchForm');
var dd = toParsModel(submitform.serializeArray());

  

function toParsModel(serializeArray) { ///serializeArray=[{name:'name',value:'value'},......] var model = {}; try { for (i = 0; i < serializeArray.length; i++) { var item = serializeArray[i]; model[item.name] = item.value; }; } catch (e) { console.log(e); } return model; }
posted @ 2018-12-06 09:49  一生热情、  阅读(138)  评论(0编辑  收藏  举报