ASP中如何使用Ajax.FormData
网上没有找到相关的答案,这里演示:
$("input[type=submit]").on("click", function () {
var formData = new FormData($("#bind")[0]);
formData.append("ajax", 1);
formData.append("func", "bind");
formData.append("act", "save");
$.ajax({
type: 'post',
data: Submit_FormDataToJSON(formData),
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;
});
var Submit_FormDataToJSON = function (formData) {
var objData = {};
for (var entry of formData.entries()) {
objData[entry[0]] = entry[1];
}
return objData;
};
以上在弘帝建站系统客户关系管理绑定会员功能实现,路径:login/js/crm.bind.js
会员管理里中也用到:login/js/hondy.form.js,login/js/member.js
|