douhoulei4706 2018-11-18 18:34
浏览 114
已采纳

处理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 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");
        }
     }
    });
    }
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥20 iOS绕地区网络检测
  • ¥15 python验证码滑块图像识别
  • ¥15 根据背景及设计要求撰写设计报告
  • ¥15 QT6颜色选择对话框显示不完整
  • ¥20 能提供一下思路或者代码吗
  • ¥15 用twincat控制!
  • ¥15 请问一下这个运行结果是怎么来的
  • ¥15 单通道放大电路的工作原理
  • ¥30 YOLO检测微调结果p为1
  • ¥15 DS18B20内部ADC模数转换器