jQuery AJAX form data serialize using PHP

前端 未结 7 1458
轻奢々
轻奢々 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 this

     $(document).ready(function(){
        var form=$("#myForm");
        $("#smt").click(function(){
        $.ajax({
                type:"POST",
                url:form.attr("action"),
                data:$("#myForm input").serialize(),//only input
                success: function(response){
                    console.log(response);  
                }
            });
        });
        });
    

提交回复
热议问题