参考示例:Hondy.Site.Login.Js.Member.js
$("body").on("submit", "form[name=profile]", function () {
var id = $(this).find("[type=submit]").attr("rel");
var formData = new FormData($("body form[name=profile]")[0]);
var name = formData.get("name");
var gender = formData.get("gender");
var mobile = formData.get("mobile");
var email = formData.get("email");
var qq = formData.get("qq");
var company = formData.get("company");
var post = formData.get("post");
var positional = formData.get("positional");
formData.append("ajax", 1);
formData.append("func", "memeber");
formData.append("act", "save");
formData.append("id", id);
$.ajax({
data: Submit_FormDataToJSON(formData),
type: "post",
dataType: "json",
success: function (data) {
if (data.stat === "ok") {
alert(common.submit + common.success + "!");
var o = $("body").find("table td :checkbox[name=id][value=" + id + "]").prop("checked", "checked");
o.closest("tr").find("td").eq(1).html(name);
var Gender=parseInt(gender) ? "True" : "False";
o.closest("tr").find("td").eq(2).html(eval("member.caption." + Gender));
o.closest("tr").find("td").eq(3).html(mobile);
o.closest("tr").find("td").eq(4).html(email);
o.closest("tr").find("td").eq(5).html(qq);
o.closest("tr").find("td").eq(6).html(company);
o.closest("tr").find("td").eq(7).html(post);
o.closest("tr").find("td").eq(8).html(positional);
$(".pop").remove();
} else {
ErrorID(data.msg, data.id);
}
}
});
return false;
}); |