0

我已经使用 jquery 提交了一个表单

使用以下格式(HTML 表单)

$(document).ready(function () {       
    $("#form_submit").click(function() {
        $("#RegisterUserForm").trigger('submit'); 
    }); 

    $("#RegisterUserForm").validate({ 
        onkeyup: false, 
        submitHandler: contact_submit 
    });

    $('#verificationcode').attr('value', '');

    function contact_done() { 
        window.location = '/'; 
    }
    function contact_submit() {
        $.ajax({
            type: "POST",
            url: "thankyou.php",
            data: $("#contact_form").serialize(),
            success: function(data){
                if (data == "SUCCESS")
                    alert('sucess');    
                else if (data == "BADCODE")
                    alert("The security code you typed was wrong. Please try again.");
                else
                    //alert("Message not sent, please try again. Error data: "+data);
            }
        });
    }
});

php代码是:

sendmail(params)
{ 
    echo "SUCCESS";
} 
else 
{      
    echo "BADCODE";
} 

在 iframe 中,我正在提交表单,但它在页面本身中打印值 Success 或 badcode 而不返回到 jquery 表单

4

0 回答 0