Quantcast
Channel: Recent Discussions — DataTables forums
Viewing all articles
Browse latest Browse all 81728

Creating a Datatables from a json files -> blank page

$
0
0

Hi,

I'm trying to create a DataTables. For that I have a data.json file that looks like :

[
  {
    "Chariot": "ASSET57",
    "Zone": "STOC2",
    "Type": "armoire",
    "Quantité": 5,
    "sav": "non"
  },
  {
    "Chariot": "ASSET130",
    "Zone": "ARRI1",
    "Type": "armoire",
    "Quantité": 0,
    "sav": "oui"
  },
  {
    "Chariot": "ASSET44",
    "Zone": "DEPA1",
    "Type": "chaise",
    "Quantité": 0,
    "sav": "non"
  }
]

Then a tableau.js where I write :

$(document).ready(function() {
    $('#example').DataTable( {
        data: data,
        columns: [
            { data: "Chariot" },
            { data: "Zone" },
            { data: "Type" },
            { data: "Quantité" },
            { data: "sav" },
        ]
    } );
} );

Both data.json and tableau.js are in a /data repository
and finally the html file where I put :

<head>

<script src="https://code.jquery.com/jquery-3.4.1.js" integrity="sha256-WpOohJOqMqqyKL9FccASB9O0KwACQJpFTUBLTYOVvVU=" crossorigin="anonymous"></script>

<link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/1.10.20/css/jquery.dataTables.css">
  
<script type="text/javascript" charset="utf8" src="https://cdn.datatables.net/1.10.20/js/jquery.dataTables.js"></script>

</head>

<body>

<script type="text/javascript" src="data/tableau.js"></script>

</body>

And I obtain a blank page... I don't understand what's wrong.

Could you help me ?

Thank's in advance !


Viewing all articles
Browse latest Browse all 81728

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>