I need to fetch data from local database and send that to server. Problem I am facing is, my post method is getting executed before success callback is completed in db.executeSq method. I need process to wait till it is completed.
sql = "select * from muser" ;
db.executeSql(sql,{})
.then((data) => {
console.log("Got data from DB");
})
.catch(e => console.log(e));
console.log("End of Function");
This is rough form of my code. I expect output as:
O/P:
Got data from DB
End of Function
But I am getting output as:
O/P:
End of Function
Got data from DB
please help me.