首页 > 代码库 > jquery将form表单序列化常json

jquery将form表单序列化常json

var formData = http://www.mamicode.com/{};
$.each(form.serializeArray(),function(i, item){
formData[item.name] = item.value;
});

 

$.ajax({
cache: true,
type: "POST",
url:ajaxCallUrl,
data:$(‘#yourformid‘).serialize(),// 你的formid
async: false,
error: function(request) {
alert("Connection error");
},
success: function(data) {
$("#commonLayout_appcreshi").parent().html(data);
}
});