I'm having issues redefining tPrice further below it seems to still return as 0 and I need it to pull from json. Is it that the inner inner function redefined the tPrice and how do I force return outside as a global.
if (tPrice == 0 ){
var xhr3 = new XMLHttpRequest();
xhr3.open("GET", "APICALL",true);
xhr3.send();
xhr3.onreadystatechange = function() {
if (xhr3.readyState == 4) {
var resp3 = JSON.parse(xhr3.responseText);
tPrice = resp3.USD;
}
}
}