I am trying to take a sqlite database (ex. data.db) and display in a HTML page. If I can display in table that would be great. But right now, I just want to see the data. I have tried everything I could find thus far.
I am using sql.js as the framework and below is my code.
<html>
<head>
<title>Title</title>
<script type="text/javascript" src="https://raw.githubusercontent.com/kripken/sql.js/master/js/sql.js"></script>
<script type="text/javascript" src="https://raw.githubusercontent.com/kripken/sql.js/master/js/worker.sql.js"></script>
<script src='sql.js'></script>
<script type="text/javascript">
var xhr = new XMLHttpRequest();
xhr.open('GET', 'data.db', true);
xhr.responseType = 'arraybuffer';
xhr.onload = function(e) {
var uInt8Array = new Uint8Array(this.response);
var db = new SQL.Database(uInt8Array);
var contents = db.exec("SELECT * FROM my_table");
};
xhr.send();
</script>
</head>
<body>
<h1>Database Data</h1>
...data to display here...