local json file to data
See original GitHub issueHi, I am trying attach json file which is located in same folder to the table but table is not visible. I cant find any example for total beginners, can you please help what I am doing wrong? I am using latest tabelator and this simple html page:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="tabulator.min.css">
<link rel='stylesheet' href='bootstrap.min.css'>
<script type="text/javascript" src="tabulator.min.js"></script>
</head>
<body>
<div class='container'>
<p>Test json loading</p>
<div id="example-table"></div>
<!-- ---------------------------------------------------------------- -->
<script type="text/javascript">
$("#example-table").tabulator({
columns:[
{title:"#", field:"id"},
{title:"Name", field:"name"},
{title:"Card ID", field:"card"},
{title:"Access", field:"access"},
],
});
$("#example-table").tabulator("setData", "/users_data.json" );
</script>
<!-- -------------------------------------------------------------------- -->
<p>test</p>
</div>
</body>
</html>
json file users_data.json contains these data:
[
{
"id": 1,
"name": "Gustav Haas",
"card": "1254874",
"access": "801"
},
{
"id": 2,
"name": "John Strauss",
"card": "45ea87a",
"access": "401"
},
{
"id": 3,
"name": "Peter Philips",
"card": "188dabf",
"access": "301"
},
{
"id": 4,
"name": "Dan Svensen",
"card": "eddaf34",
"access": "101"
},
]
Thank you very much! pptsk
Issue Analytics
- State:
- Created 5 years ago
- Reactions:1
- Comments:10 (4 by maintainers)
Top Results From Across the Web
Loading local JSON file - javascript - Stack Overflow
Transform the JSON file into a JavaScript by creating a function that returns the data as JavaScript object. Then you can load it...
Read more >How to import local json file data to my JavaScript variable?
We have an employee.json file in a directory, within the same directory we have a js file, in which we want to import...
Read more >How to Read a JSON File in JavaScript - freeCodeCamp
One standard method we can use to read a JSON file (either a local file or one uploaded to a server) is with...
Read more >How to Read & Parse local JSON file in Swift - Praveen Kommuri
Today, we will learn how to read the JSON file from your project file system & parse the content using JSONDecoder class.
Read more >How to read an external local JSON file in JavaScript - Edureka
Your answer · Mention the path of the json file in the script source along with the javascript file. <script type="text/javascript" src="data.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Not sure I see that: data:tabledata, //load row data from array
It left to the user to figure out where tabledata is coming from.
Hi, Finally its works! here full example for other beginners:
modified user_data.json
thank you! pptsk