Is there a way to set the variable "username_show" from this PouchDB document? I attempted using hoisting, but it seems that I may need to move the global variable outside of the data structure and then outside of the function.
var db = new PouchDB('myDb');
var remoteCouch = false;
var username_show;
function loadSettings(){
var settings = {
_id: "UNa",
username : ""
}
db.get('UNa').then(function (doc) {
var username_show=doc.username;
});
}
loadSettings();
alert("The Username="+username_show);