How to pass the jquery datepicker value in form POST method?

后端 未结 3 1171
我在风中等你
我在风中等你 2021-01-12 03:08

I have a input text in the form for date and i use JQuery datepicker to select date.

 

        
3条回答
  •  终归单人心
    2021-01-12 03:49

    That's a simple form with a datepicker

       

    Now your jquery,we are going to use some AJAX stuff:

    //init datepicker
    $(function() {
        $("#datepicker").datepicker({
            showButtonPanel: true
        });
    });
    
    //pass deatepicker to php
    $("#submitMe").click(function() {
        $.ajax({
            type: 'POST',
            url: "pass.php",
            dataType: "json",
            data: $('#myform').serialize(),
            success: function(data) {
                console.log("Done");
    
            }
        });
     return false;
    });​
    

    And finally your pass.php file

    
    

提交回复
热议问题