我需要使用Ajax提交Campaign Monitor表单数据。目前我已经使用Ajax完成了表单数据的提交,但它已经双击了。用户必须双击提交按钮。我需要单击提交数据。
表单的Html
<form action="https://xxxxxxx.createsend.com/t/d/s/audjhr/" method="post" id="subscribeForm">
<div class="cv-footer-deserve">
<input id="fieldEmail" name="cm-audjhr-audjhr" class="cv-news-input input-group-field " type="email" placeholder="Enter your email" value="" aria-label="Enter your email" required />
<button type="submit" class="subscribe cv-news-btn"><i class="fa fa-chevron-right" aria-hidden="true"></i></button>
</div>
</form>
表格的脚本
$(function () {
$("#subscribeForm").submit(function (e) {
e.preventDefault();
$.getJSON(
this.action + "?callback=?",
$(this).serialize(),
function (data) {
if (data.Status === 400) {
// error msg
} else {
// success msg
}
});
});
});