决定表单确认方法


Deciding between form confirmation methods

所以我最初想创建一个表单,在成功提交表单数据时生成一个灯箱,表示感谢提交表单,但是我读到,对于用户来说,最安全、最可靠的通知方式是使用前面提到的经典方法。如果使用花式盒子被证明是有效的,我该怎么做呢?对javascript的调用将去哪里?在PHP或HTML文件中,表单是打开的?由于该页面仅适用于手机和平板电脑,而且非常简单,所以我认为使用lightbox(我正在考虑添加fanybox)而不是制作更多页面将是一个好主意。

我在网上找资源也有困难,因为我只是得到lightbox表单并以lot box的形式发送提交结果。我只是想要一个简单的谢谢你或错误信息诚实。如果这是一个好的可行的解决方案的形式。

提前感谢!

ref.

的基本形式
<form id="fusion_form" name="fusion_form" method="post" action="fusion_form.php" target="_blank">
                        <p><input name="first_name" type="text" id="first_name" style="width:140px" value="" placeholder="First Name" /></p>
                        <p><input name="last_name" type="text" id="last_name" style="width:140px"  value="" placeholder="Last Name" /></p>
                        <p><input name="email" type="text" id="email" style="width:140px"  value="" placeholder="Email Address" /></p>
                        <p><textarea name="comments" cols="20" rows="3" id="comments" class="FormText" style="width:200px; padding-left:2px" placeholder="Comments"></textarea></p>
                        <p><input type="image" src="images/submit-button.jpg" id="send_email" value="Submit Form" onclick="return verify_form();" /></p>
</form>
$('form').on('submit', function(e){
    e.preventDefault(); // stop the form submission
    var $d = $(this).serialize(); //serialize form to be submit to server
    $.ajax({
        url: $(this).prop('action'),
        type: $(this).prop('method'),
        data: {formData : $d},
        success: function(data){
            if(false != data){
               //form submission did NOT return false
               //build lightbox, extrapolate what is needed from `data` variable
            }
        }
    });
});
php

if(isset($_POST['formData'])):
    $formData = $_POST['formData]';
    //do whatever with the form
    if(someCondition):
       return '<h4> Thank you for submitting the form!</h4>';
    else:
       return false;
    endif;
endif;