I am trying to use Ajax with icontact.. my code makes the form submit however it shows an error message, despite the form working and the details dropping into the list.
$('.error').hide();
$('.erroremail').hide();
$('#successcontainer').hide();
function verifyRequired()
{ 
    var eReg = /^([\w-\.]+@([\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;
    }
}
So the form is submitting the details fine, but showing the failure message?
So i'm almost there, anyone know why?
Cheers
here is the form also
<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>
 
     
     
    