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

报告相同问题?

悬赏问题

  • ¥15 目详情-五一模拟赛详情页
  • ¥15 有了解d3和topogram.js库的吗?有偿请教
  • ¥100 任意维数的K均值聚类
  • ¥15 stamps做sbas-insar,时序沉降图怎么画
  • ¥15 买了个传感器,根据商家发的代码和步骤使用但是代码报错了不会改,有没有人可以看看
  • ¥15 关于#Java#的问题,如何解决?
  • ¥15 加热介质是液体,换热器壳侧导热系数和总的导热系数怎么算
  • ¥100 嵌入式系统基于PIC16F882和热敏电阻的数字温度计
  • ¥15 cmd cl 0x000007b
  • ¥20 BAPI_PR_CHANGE how to add account assignment information for service line