I’m having trouble understanding how to only execute a function once another function - specifically an ajax API pull function, is complete.
I’m using a function to pull the relevant API data, and a function to add that data in the HTML. I tried using a callback function for adding the data so it would only run once the API pull was complete, but it executes with undefined unless I use a setTimout and don’t execute for a second.
Relevant CodePen: https://codepen.io/LucasLombardo/pen/aYjBjo?editors=0010
I’m stuck with this issue so any troubleshooting ideas would be welcome.