Jquery无法检索数据

时间:2016-10-21 02:28:56

标签: jquery console.log

当我columnDatas时,我有一个变量名console.log(columnDatas),我得到了这个

enter image description here

我想在console.log中获得名称 frmb_escalatedpercentageformarketingexecutives41

enter image description here

我怎么能得到这个?这是代码 -

`

 var columnDatas = new Array();
    function set_columns(tablename, ele) {
        var ls = $(ele).siblings('.left')[0];
        var rs = $(ele).siblings('.right')[0];      

        if($("#checkPlus").val() != '') {
            var firstTable = $("#tablename").val();
        } else {
            var firstTable = rs.name;
            console.log(columnDatas);                    // HERE IS THE LINE
        }

        if(tablename == "" || (firstTable != undefined && firstTable == "")) {
            bootbox.alert("<center><b>Error:</b> Please Select a Table</center>");
            $("#tablename").css('border-color','red');
            return;
        }

        if ((rs == undefined || rs == null) && (ls == undefined || ls == null)) {
            return;
        }

        if (columnDatas != 'null' && columnDatas[tablename] != undefined) {
            _set_column(ls, tablename);
            _set_column(rs, tablename);
        } else {

            if (columnDatas[tablename] == undefined || columnDatas[tablename] == null) {
            //  $.getJSON('index.php?module=ReportBuilder&action=json_getcolumns&tblname='+tablename+"&dbid="+dbid, function(json) {
                $.getJSON('<?php echo base_url();?>cdashboard/getfields/'+tablename, function(json) {

                    columnDatas[tablename] = json;
                    //_set_column(ls, tablename);
                    _set_column(rs, tablename);
                });
            } 

            if (firstTable != undefined && firstTable != "") {
            //  $.getJSON('index.php?module=ReportBuilder&action=json_getcolumns&tblname='+tablename+"&dbid="+dbid, function(json) {
                $.getJSON('<?php echo base_url();?>cdashboard/getfields/'+firstTable, function(json) {

                    columnDatas[tablename] = json;
                    _set_column(ls, tablename);
                    //_set_column(rs, tablename);
                });
            } 
        }
    }`

0 个答案:

没有答案