douhoulei4706
douhoulei4706
2018-11-18 18:34
浏览 95

处理ajax上的弹出窗口并且不显示在html上

I have a bit of a problem . I can succesfully sort my date range now but the problem is that it doesn't display on my datatable it's always has this process popup box

enter image description here

But i have the data as you can see here on the image below

enter image description here

I am using CodeIgniter 3.x by the way. Here's my code

$('.input-daterange').datepicker({
todayBtn: 'linked',
format: "yyyy-mm-dd",
autoclose: true
});

function fetch_data(start_date='', end_date=''){
var dataTable = $('#table-sales').DataTable({
    "processing": true,
    "serverSide": true,
    "order":[],
    "ajax":{
        url: "sales/rangeDates",
        type: "POST",
        data:{
            'start_date':start_date, 'end_date':end_date
        },
        success:function(data){
            $('#table-sales').html(data);
        }
    }
});
}

$('#search').click(function(){

var inv_type = $('#invType').val();
var start_date = $('#start_date').val();
var end_date = $('#end_date').val();


if(start_date != '' && end_date != '' && inv_type != 0){
    $('#table-sales').DataTable().destroy();
    fetch_data(start_date,end_date);
}else{
    alert('Both Date is Required and Choose what to show!');
}

});

Please let me know if there's a missing information I need to show you guys. Thank you.

RESPONSE:

enter image description here

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 邀请回答

1条回答 默认 最新

  • drktvjp713333
    drktvjp713333 2018-11-18 19:20
    已采纳

    Update your fetch data code

    function fetch_data(start_date='', end_date=''){
    var dataTable = $('#table-sales').DataTable({
    "processing": true,
    "serverSide": true,
    "order":[],
    "ajax":{
        url: "sales/rangeDates",
        type: "POST",
        data:{
            'start_date':start_date, 'end_date':end_date
        },
        success:function(data){
            $('#table-sales').html(data);
            $("#table-sales_processing").css("visibility","hidden");
        }
     }
    });
    }
    
    点赞 评论

相关推荐