【问题标题】:datatables not showing data from json file on localhost数据表未显示本地主机上 json 文件中的数据
【发布时间】:2015-05-18 10:08:54
【问题描述】:

数据表没有从 json 文件中获取数据,我不知道如何解决,它显示 404 错误,文件访问错误

   $(document).ready(function() {

   $('#example').dataTable( {

   "ajax": "data.json"

   } );

   } );

 </script>

/---------------------------------------------- -------------/

{
"data": [
   [

  "Tiger Nixon",
  "System Architect",
  "Edinburgh",
  "5421" 
],
[
  "Garrett Winters",
  "Accountant",
  "Tokyo",
  "8422"
],
[
  "Ashton Cox",
  "Junior Technical Author",
  "San Francisco",
  "1562"
   ]
]
}

【问题讨论】:

  • 控制台中的消息是什么?
  • localhost:56341/wp-admin/user.css 加载资源失败:服务器响应状态为 404(未找到)@Arun
  • 不使用 css。有数据表??
  • 控制台中只有这个错误!
  • 控制台显示没有错误@Arun

标签: jquery json datatables-1.10


【解决方案1】:

最后我自己修复了,我在 wordpress 中这样做,wordpress 不接受 .json 扩展名,所以我将文件扩展名更改为 .text 并给它相对路径 -

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2012-05-05
    • 1970-01-01
    • 1970-01-01
    • 2018-09-27
    • 1970-01-01
    • 2019-12-28
    • 1970-01-01
    • 2022-06-30
    相关资源
    最近更新 更多