jQuery AJAX form data serialize using PHP

前端 未结 7 1461
轻奢々
轻奢々 2020-12-05 08:07

I am stuck in my code, I need to send data from the form to the check.php page and then process it.

This is my code:

The AJAX part:



        
相关标签:
7条回答
  • 2020-12-05 09:09

    try it , but first be sure what is you response console.log(response) on ajax success from server

    <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
    <script>
    $(document).ready(function(){
    var form=$("#myForm");
    $("#smt").click(function(){
    $.ajax({
            type:"POST",
            url:form.attr("action"),
            data:form.serialize(),
    
            success: function(response){
            if(response === 1){
                //load chech.php file  
            }  else {
                //show error
            }
            }
        });
    });
    });
    

    0 讨论(0)
提交回复
热议问题