第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號(hào)安全,請(qǐng)及時(shí)綁定郵箱和手機(jī)立即綁定
已解決430363個(gè)問(wèn)題,去搜搜看,總會(huì)有你想問(wèn)的

數(shù)據(jù)表不顯示數(shù)據(jù)

數(shù)據(jù)表不顯示數(shù)據(jù)

夢(mèng)里花落0921 2023-05-25 17:19:58
我已經(jīng)像網(wǎng)站提供的那樣包含了 CDN,即使復(fù)制粘貼了每一行代碼,仍然無(wú)法顯示或顯示任何結(jié)果。這是CDN<link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/1.10.22/css/jquery.dataTables.css"><script type="text/javascript" charset="utf8" src="https://cdn.datatables.net/1.10.22/js/jquery.dataTables.js"></script>這是我的代碼<link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/1.10.22/css/jquery.dataTables.css"><script type="text/javascript" charset="utf8" src="https://cdn.datatables.net/1.10.22/js/jquery.dataTables.js"></script><body><table id="example" class="display">    <thead>        <tr>            <th>Name</th>            <th>Position</th>            <th>Salary</th>        </tr>    </thead></table></body>這是腳本[    {        "name":       "Tiger Nixon",        "position":   "System Architect",        "salary":     "$3,120"    },    {        "name":       "Garrett Winters",        "position":   "Director",        "salary":     "$5,300"    }]$('#example').DataTable( {    data: data,    columns: [        { data: 'name' },        { data: 'position' },        { data: 'salary' }    ]} );
查看完整描述

2 回答

?
富國(guó)滬深

TA貢獻(xiàn)1790條經(jīng)驗(yàn) 獲得超9個(gè)贊

你錯(cuò)過(guò)了兩件事:

  1. JQuery 庫(kù)

  2. 變量data_

請(qǐng)檢查以下解決方案。

var data = [{

    "name": "Tiger Nixon",

    "position": "System Architect",

    "salary": "$3,120"

  },

  {

    "name": "Garrett Winters",

    "position": "Director",

    "salary": "$5,300"

  }

]

$('#example').DataTable({

  data: data,

  columns: [{

      data: 'name'

    },

    {

      data: 'position'

    },

    {

      data: 'salary'

    }

  ]

});

<html>

<link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/1.10.22/css/jquery.dataTables.css">

<script src="https://code.jquery.com/jquery-3.5.1.min.js" integrity="sha256-9/aliU8dGd2tb6OSsuzixeV4y/faTqgFtohetphbbj0=" crossorigin="anonymous"></script>

<script type="text/javascript" charset="utf8" src="https://cdn.datatables.net/1.10.22/js/jquery.dataTables.js"></script>


<body>

<table id="example" class="display">

    <thead>

        <tr>

            <th>Name</th>

            <th>Position</th>

            <th>Salary</th>

        </tr>

    </thead>

</table>

</body>

</html>


查看完整回答
反對(duì) 回復(fù) 2023-05-25
?
哈士奇WWW

TA貢獻(xiàn)1799條經(jīng)驗(yàn) 獲得超6個(gè)贊

jquery datatables.js 需要jquery。你應(yīng)該在 jquery.datatables.js 之前添加它。


 <link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/1.10.22/css/jquery.dataTables.css">

     <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>

     <script type="text/javascript" charset="utf8" src="https://cdn.datatables.net/1.10.22/js/jquery.dataTables.js"></script>



  And you even don't need to define columns in your datatable, datatables does the work itself :




    <body>

       <table id="example" class="display" width="100%"></table>

    </body>




    <script>


    var dataSet = [

      [ "Tiger Nixon", "System Architect", "Edinburgh", "5421", "2011/04/25", "$320,800" ],

      [ "Garrett Winters", "Accountant", "Tokyo", "8422", "2011/07/25", "$170,750" ],

   

    ];


    $(document).ready(function() {

      $('#example').DataTable( {

         data: dataSet,

         columns: [

            { title: "Name" },

            { title: "Position" },

            { title: "Office" },

            { title: "Extn." },

            { title: "Start date" },

            { title: "Salary" }

         ]

      } );

     } );

    </script>


查看完整回答
反對(duì) 回復(fù) 2023-05-25
  • 2 回答
  • 0 關(guān)注
  • 175 瀏覽
慕課專(zhuān)欄
更多

添加回答

舉報(bào)

0/150
提交
取消
微信客服

購(gòu)課補(bǔ)貼
聯(lián)系客服咨詢(xún)優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號(hào)

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號(hào)