如何在页面加载期间使用datepicker中的ajax请求发送默认日期,然后在更改日期时发送ajax

时间:2016-12-13 10:36:46

标签: jquery ajax datepicker

我希望ajax请求应该在页面加载时发送默认日期

$(document).ready(function(){
    $('#schedule_datepicker').datepicker({dateFormat:'yy-mm-dd'}).datepicker("setDate", new Date()).on("change", function () {
        var dataTable = $('.table-wrap').DataTable( {
            "processing": true,
            "serverSide": true,
            "bDestroy": true,
            "ajax":{
                url: '<?php echo TEMPLATES_URI."schedule_ajax.php"; ?>',
                type: "post",
                data:{date_time:$('#schedule_datepicker').val()},
                error: function(){ 
                    $(".employee-grid-error").html("");
                    $("#employee-grid").append('<tbody class="employee-grid-error"><tr><th   colspan="3">No data found in the server</th></tr></tbody>');
                    $("#employee-grid_processing").css("display","none");   
                }
            }
        });     
    });

使用新日期ajax请求应发送

0 个答案:

没有答案