My student has created an api that calls Yelp and then loads a dropdown on a second form.
Sometimes it works (ie. loads the dropdown) and sometimes it doesn’t (doesn’t get anything back from the API call). See attached - I think it might be a timing problem - if so, is there a way to tell Appstudio to wait? Thanks!
11 Project1.appstudio.zip (25.5 KB)
I think the problem is that the call to Yelp is asynchronous, but the program assumes it will get a synchronous response.
The call to Yelp is done using a
fetch statement. You need to wait for it to return before continuing processing. We don’t know how long to wait - that’s subject to Yelp and the internet.
The solution is to use an
await statement. Here’s an article on