TypeError:f未定义 [英] TypeError: f is undefined

查看:163
本文介绍了TypeError:f未定义的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在创建一个dataTable,其中表的数据完全来自数据库.我尝试了以下方式: HTML:

I'm creating a dataTable, where the data for the table is entirely from the database. I tried in the following way: HTML:

<div class="col-sm-10">
                <table border="0" cellpadding="0" cellspacing="0" width="100%" id="invoice_table" class="table table-bordered table-colstriped table-hover display">
                    <thead>
                        <tr>
                            <th>ID</th>
                            <th>Name</th>
                            <th>Chain Name</th>
                            <th>Type</th>                       
                            <th>Amount</th>
                            <th>Billable Amount</th>
                        </tr>
                    </thead>
                    <tbody>
                    </tbody>
                </table>
            </div>

jQuery:

 function year_month(year_month) {
                     jQuery("#invoice_table").dataTable({
                        "sAjaxSource": "invoice-request-db.php?mode=invoice_dataTable&year_month=" + jQuery("#year_month").val(),
                        "bDestroy": true,
                        "bPaginate": false,
                        "bInfo": false,
                        "bFilter": false,
                        "bSort": false
                    });
                }

我必须传递一个数据,该数据是URL的年份-月份,以便数据表根据我选择的年份-月份进行更改.但是,当我尝试使用它时,出现"TypeError:f is undefined",显示在jquery.dataTables.min.js中.这怎么了我该如何纠正?

I'll have to pass a data, which is the year-month along with the url, so that the datatable gets changed according to the year-month I select. But, when I try using it, I get "TypeError: f is undefined", which is showed in jquery.dataTables.min.js. What's wrong with this? What should I correct?

推荐答案

jQuery代码中的错误替换为此. dataTable({未关闭

Error in your jQuery code Replace with this. dataTable({ is not closed

 jQuery("#invoice_table").DataTable({
    "sAjaxSource": "invoice-request-db.php?mode=invoice_dataTable",
    "bDestroy": true,
    "bPaginate": false,
    "bInfo": false,
    "bFilter": false,
    "bSort": false
}); 

这篇关于TypeError:f未定义的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆