0
我想用icontact使用Ajax ..我的代碼使表單提交但是它顯示一個錯誤消息,儘管表單工作和細節放入列表中。ajax jquery提交圖標形式
$('.error').hide();
$('.erroremail').hide();
$('#successcontainer').hide();
function verifyRequired()
{
var eReg = /^([\w-\.][email protected]([\w-]+\.)+[\w-]{2,4})?$/; // regex to check valid email
var email = $('input[name="fields_email"]').val();
var name = $('input[name="fields_fname"]').val();
var phone = $('input[name="fields_phone"]').val();
var data = $("#form-popup").serialize()
if (email == "") {
$('input[name="fields_email"]').focus();
$('.error').show();
return false;
} else if (!eReg.test(email)) {
$('input[name="fields_email"]').focus();
$('.erroremail').show();
return false;
}
else if (name == "") {
$('input[name="fields_name"]').focus();
$('.error').show();
return false;
}
else if (phone == "") {
$('input[name="fields_phone"]').focus();
$('.error').show();
return false;
}
else {
$.ajax({
url: "https://app.icontact.com/icp/signup.php",
type: "POST",
data: data,
success: function(){
alert('success')
},
error: function(){
alert('failure')
},
});
return false;
}
}
所以表單提交的細節很好,但顯示失敗的消息?
所以我幾乎在那裏,任何人都知道爲什麼?
乾杯
這裏是形式也
<form id="form-popup" method="post" action="" name="icpsignup" accept-charset="UTF-8" onsubmit="return verifyRequired();" >
<input type="hidden" name="redirect" value="http://www.icontact.com/www/signup/thanks.html">
<input type="hidden" name="errorredirect" value="http://www.icontact.com/www/signup/error.html">
<input type="text" name="fields_fname" class="input" id="name" placeholder="Full Name" />
<input type="text" name="fields_email" class="input" id="email" placeholder="Email Address" />
<input type="text" name="fields_phone" class="input" id="phone" placeholder="Telephone" />
<input type="submit" id="submit" />
<input type="hidden" name="listid" value="xxxxxxx">
<input type="hidden" name="specialid:xxxxx" value="xxxx">
<input type="hidden" name="clientid" value="xxxxxx">
<input type="hidden" name="formid" value="xxxx">
<input type="hidden" name="reallistid" value="1">
<input type="hidden" name="doubleopt" value="0">
</form>
如果您分享了錯誤消息,它將幫助我們很多。 – Blazemonger
語法錯誤:'alert('failure')},'< - 刪除逗號 – aldanux
它只是彈出一個警告說現在失敗。 –