Like this:
function getData(dataURI, callback) {
var timer = setTimeout(function () { // simulated 3 second delay
var dataArray = [123, 456, 789, 012, 345, 678]; // faked data
console.log(dataArray);
}, 3000);
}
getData('http://fakedomain1234.com/userlist', function (myData) {
console.log(myData);
});
document.getElementById('consoleBox').innerHTML += 'show this before data ...';
function getData(dataURI, callback) {
var timer = setTimeout(function () { // simulated 3 second delay
var dataArray = [123, 456, 789, 012, 345, 678]; // faked data
console.log(dataArray);
}, 3000);
}
getData('http://fakedomain1234.com/userlist', function (myData) {
console.log(myData);
});
document.getElementById('consoleBox').innerHTML += 'show this before data ...';