$("input[type=submit]").on("click", function () {
var formData = new FormData($("form")[0]);
formData.append("ajax", "1");
formData.append("func", "bind");
formData.append("act", "save");
$.ajax({
data: formData,
type: 'post',
async: false,
cache: false,
contentType: false,
processData: false,
dataType: 'json',
success: function (data) {
console.log(data);
if (data.stat === "ok") {
$(".pwd").parent().append(common.submit + common.success + "!");
} else {
err(data.msg);
}
}
});
return false;
});
以上在C#中通过,弘帝云代码摘录自:cloud.agent.account.contact/contact.js
【jQuery】ajax利用serializer进行form传值
http://wh.ac.cn/forum.php?mod=viewthread&tid=2504&fromuid=1
|