dousu8767 2015-11-25 06:46
浏览 52

使用ajax codeigniter php基于日期检索数据库值

I want to retrieve database values using ajax based on date range selected on the form by using codeigniter. The scenario is very straight forward. when the user select the daterange from the datepicker the desired system should callback to DB for retrieveing specific student's report and fill the bootstrap table with retrieved values to new without reloading the page for getting data. view page of attendance checkout

attendance table on database

  • 写回答

3条回答 默认 最新

  • dongye1942 2015-11-25 06:53
    关注

    Php query,

    select *
    from table_name
    where date(date) between date('from date') and date('to date')
    

    Ajax for this

    $("#generate").on('click', function (e) {
        e.preventDefault();
        $.ajax({
            url: 'path to controller method',
            type: 'post',
            data: {fromdate:$("#fromdate").val(),todate:$("#todate").val()},
            success: function (data) {
                  alert(data);
            }
        });
    });
    

    For generate button give id as generate, also give from from date and to date

    echo the content in controller, it will come in ajax success in data. you can append to required div.

    评论

报告相同问题?

悬赏问题

  • ¥100 为什么这个恒流源电路不能恒流?
  • ¥15 有偿求跨组件数据流路径图
  • ¥15 写一个方法checkPerson,入参实体类Person,出参布尔值
  • ¥15 我想咨询一下路面纹理三维点云数据处理的一些问题,上传的坐标文件里是怎么对无序点进行编号的,以及xy坐标在处理的时候是进行整体模型分片处理的吗
  • ¥15 CSAPPattacklab
  • ¥15 一直显示正在等待HID—ISP
  • ¥15 Python turtle 画图
  • ¥15 stm32开发clion时遇到的编译问题
  • ¥15 lna设计 源简并电感型共源放大器
  • ¥15 如何用Labview在myRIO上做LCD显示?(语言-开发语言)