从jquery dataTable获取Json数据

时间:2013-06-07 02:15:23

标签: javascript jquery ajax yui-datatable

我试图从sAjaxSource获取Json,但它会像那样

Uncaught TypeError: Cannot call method 'fnInit' of undefined 

$.ajax({
                type : 'POST',
                url : 'classfication_of_productjson.html',
                dataType : 'json',
                data : {
                    "limited_num" : limited_num,
                    "search_bunrui_code" : code,
                    "orderType" : orderType,
                    "search_base_date_from" : search_base_date_from,
                    "search_base_date_to" : search_base_date_to,
                    "compare_date_from" : compare_date_from,
                    "compare_date_to" : compare_date_to,
                    "compare_menu" : compare_menu,
                    "shopCode0000" : shopCode0000,
                    "shopCode0001" : shopCode0001,
                    "shopCode0002" : shopCode0002,
                    "shopCode0009" : shopCode0009,
                    "shopCode0003" : shopCode0003,
                    "shopCode0006" : shopCode0006,
                    "shopCode9000" : shopCode9000,
                    "shopCode9001" : shopCode9001
                },

                success : function(data) {
                    console.log(data);
                    $('#dataTable').dataTable({
                        "bServerSide": true,
                        "sAjaxSource": data,
                        "sAjaxDataProp": data,
                        "bProcessing": true,
                        "sPaginationType": "full_numers",
                        "bJQueryUI": true
                    });
                    //$('#loadData').html(data);
                    var elapsed = (new Date().getTime() - start) / 1000;
                    $("#search_time").html("検索時間<br>" + elapsed + "(s)");
                    visibleColumn();
                },
                 beforeSend : call_request,
                complete : complete_request,
            });

问题是我可以像上面的代码一样在“sAjaxSource”中获取数据json。 上面的数据是来自服务器的json格式的数组对象 谢谢你的帮助

0 个答案:

没有答案