I have different buttons on my page, and each time I click on it, different requests will be generated to access the database. I already had one "queryDB" function to retrieve all the data in the table, and when I press the reset button, another query to UPDATE the table values.
I noticed that DID NOT went to FUNCTION " resetDB ". Is it because the phoneGap function uses only the queryDB function? How do i solve this?
*** New found problem ** I understand that when I use location.reload (), it does not update the table. Therefore, I did not use it, it went into the function and updated the database, but did not show the βnewβ page. If I use href on the settings page, it will not update the database as before.
$('button#reset').on("click",function(){ var db = window.openDatabase("Database", "1.0", "ApplicationDB", 200000); db.transaction(resetDB, errorCB); location.reload(); });
ResetDB function
function resetDB(tx) { tx.executeSql("UPDATE RESULT SET Difficulty = 'Easy' " , [], querySuccess, errorCB); }
Function Request DB
function queryDB(tx) { tx.executeSql("SELECT * FROM RESULT ORDER BY Level" , [], querySuccess, errorCB); }
source share