title: JavaScript sql.js - is callback correct?
body: <p>So i keep getting [object Object] where actually the result of a query should be. My question is, whether my callback is incorrect, because I have a hard time understanding it, but think i did it correct. </p>
  
  <p>HTML-part:</p>
  
  <pre><code>&lt;button type="button" id="input_search" onclick="getSearchFromSQL()"&gt;Search&lt;/button&gt;
  </code></pre>
  
  <p>JS-part:</p>
  
  <pre><code>function getSearchFromSQL() {
      document.getElementById('output').innerHTML = contents;
  }
  
  getSearchAsync(function (result) {
  
      contents = result;
  });
  
  function getSearchAsync(callback) {
      var xhr = new XMLHttpRequest();
      xhr.open('GET', 'test123.sqlite3', true);
      xhr.responseType = 'arraybuffer';
  
      xhr.onload = function (e) {
          var uInt8Array = new Uint8Array(this.response);
          db = new SQL.Database(uInt8Array);
          callback(db.exec("SELECT * FROM data"));
      };
      xhr.send();
  }
  </code></pre>
  
  <p>I want to add, that my IDE tells me, that "SQL" is not declared as a global variable - not sure if there is a problem, since sql.js is implemented in the html-file.</p>