admin管理员组文章数量:1323029
I am trying to figure out how to use the data-url property of Bootstrap table Here is my code. I have added all the necessary CSS/JS files and referenced a correct JSON form file in the the data-url property but still it ain't showing any results. What am I missing here ?
<!doctype html>
<html lang="en">
<head>
<!-- Required CSS -->
<link rel="stylesheet" href=".3.7/css/bootstrap.min.css">
<link rel="stylesheet" href=".11.1/bootstrap-table.css">
</head>
<body>
<table class ="table table-hover" id ="table" data-toggle="table" data-url=".json">
<thead>
<tr>
<th data-field="id">Item ID</th>
<th data-field="name">Item Name</th>
<th data-field="price">Item Price</th>
</tr>
</thead>
</table>
</body>
<!-- Required js -->
<script src=".2.1/jquery.min.js"></script>
<script src=".3.7/js/bootstrap.min.js"></script>
<script src=".11.1/bootstrap-table.js"></script>
<script>
$(table).bootstrapTable('refresh', {
url: '.json'
});
</script>
</html>
I am trying to figure out how to use the data-url property of Bootstrap table Here is my code. I have added all the necessary CSS/JS files and referenced a correct JSON form file in the the data-url property but still it ain't showing any results. What am I missing here ?
<!doctype html>
<html lang="en">
<head>
<!-- Required CSS -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn./bootstrap/3.3.7/css/bootstrap.min.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare./ajax/libs/bootstrap-table/1.11.1/bootstrap-table.css">
</head>
<body>
<table class ="table table-hover" id ="table" data-toggle="table" data-url="https://raw.githubusercontent./wenzhixin/bootstrap-table-examples/master/json/data1.json">
<thead>
<tr>
<th data-field="id">Item ID</th>
<th data-field="name">Item Name</th>
<th data-field="price">Item Price</th>
</tr>
</thead>
</table>
</body>
<!-- Required js -->
<script src="https://cdnjs.cloudflare./ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn./bootstrap/3.3.7/js/bootstrap.min.js"></script>
<script src="https://cdnjs.cloudflare./ajax/libs/bootstrap-table/1.11.1/bootstrap-table.js"></script>
<script>
$(table).bootstrapTable('refresh', {
url: 'https://raw.githubusercontent./wenzhixin/bootstrap-table-examples/master/json/data1.json'
});
</script>
</html>
Share
Improve this question
asked Apr 22, 2017 at 23:39
Syed Ahmed JamilSyed Ahmed Jamil
2,1113 gold badges23 silver badges38 bronze badges
1 Answer
Reset to default 3Look in the network tab in your browser debugger. Most likely you're getting a 400 error because of the Same-origin Policy. The browser can't* request content from a different domain than the one it's hosted on.
*Generally true, there are ways around this.
https://developer.mozilla/en-US/docs/Web/Security/Same-origin_policy
本文标签: javascriptHow to correctly use Bootstrap table dataurl propertyStack Overflow
版权声明:本文标题:javascript - How to correctly use Bootstrap table data-url property? - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1742110015a2421203.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论