Reputation: 63
I am trying to fetch data from IndexedDB and display it on screen. However, for some reason it is not displaying anything on screen. The data is already in IndexedDB and I do not have any errors. It is just not popping up on screen.I am getting the data:
var tx = db.transaction('keyval',"readonly");
var store = tx.objectStore('keyval');
return store.getAll();
for (message in buses)
{
var el = document.createElement('div');
var content = document.createTextNode(buses[message]);
el.appendChild(content);
document.body.appendChild(el);
document.getElementById("data").innerHTML = el;
}
I cannot seem to figure out what I am doing wrong here. Any help is appreciated.
Upvotes: 0
Views: 1258
Reputation: 2720
store.getAll() returns an IDBRequest, not an array. If that doesn't help, post a full example or a link to a jsfiddle.
https://developer.mozilla.org/en-US/docs/Web/API/IDBObjectStore/getAll
Upvotes: 1