Created
January 27, 2013 12:19
-
-
Save glynrob/4648124 to your computer and use it in GitHub Desktop.
WebSQL Load saved data
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// get the locally saved data | |
function loadSavedData(){ | |
db.transaction(function (tx) { | |
tx.executeSql('SELECT * FROM data', [], function (tx, results) { | |
console.log(results); | |
var len = results.rows.length, i; | |
for (i = 0; i < len; i++) { | |
var saveItem = { | |
"value": results.rows.item(i).text, | |
"label": results.rows.item(i).id | |
}; | |
itemCount++; // increase labelname by 1 | |
savedData.push(saveItem); | |
} | |
// don't run html display until the query has been fully executed | |
showListItems();// Generate the list items and display | |
showLocalData();// show data | |
}); | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment