【发布时间】:2018-02-18 02:24:59
【问题描述】:
您好,我正在尝试在每个选项卡和数据表中显示 json 数据 谁能告诉我该怎么做?
我尝试在谷歌上查找没有运气
我喜欢这样 https://www.w3schools.com/bootstrap/tryit.asp?filename=trybs_tabs_dynamic&stacked=h
但有数据表和它自己的硬币列表,如 json 文件中的 btc 第一个选项卡等
编辑 stacey 给我的代码它不显示它只是向我显示一个如下图所示的空白页面,除非它的 java 脚本?但是需要它在json中吗?
https://i.stack.imgur.com/jp6w5.jpg
list.json
[{"coinlist",
"Bitcoin faucets":
"faucet name":"btc Faucet",
"minutes": "5",
"amount": "90",
"claim link": "http://bitcoinsfaucets.com",
// next faucet off bitcoin goes here!
},
{
"eth faucets":
"faucet name":"eth Faucet",
"minutes": "15",
"amount": "1000",
"claim link": "http://ethwebsite.com",
// next faucet off eth goes here!
},
{
"bitcore faucets":
"faucet name":"bitcore Faucet",
"minutes": "24",
"amount": "5000",
"claim link": "http://bitcorefaucets.com",
// next faucet off bitcore goes here!
},
{
"primecoin faucets":
"faucet name":"prime Faucet",
"minutes": "55",
"amount": "3000",
"claim link": "http://primecoinfaucets.com",
// next faucet off primecoin goes here!
]
}
]
数据表
<table id=“list” class="table table-bordered table-condensed table-hover" cellspacing="0" width="100%">
<thead>
<tr>
<th>name</th>
<th>timer</th>
<th>amount</th>
<th>cliam link</th>
</tr>
</thead>
<tfoot>
</tfoot>
</table>
</div>
javascript
<script type="text/javascript">
$(document).ready(function() {
$(‘#list’).DataTable();
} );
</script>
【问题讨论】:
-
嗨!如果您签出代码中的How to create a Minimal, Complete, and Verifiable example 以备将来在堆栈溢出时使用会更好。 -谢谢
-
你的数据很乱,不是一个有效的数组...
标签: javascript php json sorting tabs