Move the code that is currently inside of your script
tag to a separate file, say side.js
:
$(document).ready(function() { $('#mainTable').DataTable( {"ajax": "jsonData","columns": [ { "data": "level" }, { "data": "value" }, { "data": "description" } ] } ); } );
Change the script tag to be
<script source="./side.js"></script>
It looks from some of your other code (require...
) that you are attempting to execute Node.js inside of the HTML. Node.js is executed on the server side; all of the Javascript in the HTML will be executed on the client-side (browser).
ETA: now that you've updated with the code, I see that, yes, you are attempting to use Node.js inside of the HTML. It won't work - you can't require
inside of the user's browser.