My script is set up like this:
function apiGrab() {
changingVar = something grabbed from an API;
}
function apiDisplay() {
alert(changingVar);
}
But the problem is, whenever the apiDisplay function runs, the API hasn't quite finished getting the information I need. If I were to use the apiDisplay function again after a few seconds (I run it with a button), it would display my information correctly it because I gave the API time to grab the variable.
Are there any solutions that I can use to give apiDisplay a short delay (if there any other possible solutions, please suggest them <3)?