1. 自定义表单
使用场景:反馈意见的提交
默认模板表单代码
<form class="ms-content-form" method="post" id="postForm">
<input class="ms-content-form-name" type="text" name="name" placeholder="姓名">
<input class="ms-content-form-phone" type="text" name="phone" placeholder="手机">
<textarea class="ms-content-form-message" name="words" placeholder="留言"></textarea>
<div class="ms-login-button">提交</div>
</form>
var flag = false;
$(".ms-login-button").click(function() {
if(!flag) {
$.ajax({
type: "POST",
url: "{ms:global.host/}/mdiy/post/7df6529f9eaa26da7ae4e01c7f73aa06.do",
data: $("#postForm").serialize(),
success: function(msg) {
flag = true;
alert("提交成功");
location.reload();
}
});
} else {
alert("您已经提交过了!");
}
})