global.games = {};
let sql = /* some Sql */;
connection.query(sql, function(err, results) {
/* results must be parsed and stored in global.games, but I can see them only inside this function*/
});
How can I get the results outside callback?
global.games = {};
let sql = /* some Sql */;
connection.query(sql, function(err, results) {
/* results must be parsed and stored in global.games, but I can see them only inside this function*/
});
How can I get the results outside callback?
You can add response object to JavaScript global object window
window.global.games = {};
let sql = /* some Sql */;
connection.query(sql, function(err, results) {
window.global.games = results;
});