“Ask a question and wait for an answer” loop

I need help, I am developing BaseLinker API applications with new features.

For better performance I used Dynamic Card View.
To get data I have to use two queries:

  1. WEB1 - basic data,
  2. WEB2 - image,

Basic data is fetched immediately and data is displayed correctly, on separate cards.

I have a problem with an image, the query takes a while to respond. The for loop sends the query too fast and the images do not display in the cards.

I can manually call the image by pressing the card, but I would like it to be received automatically.

Using a timer to release the loop is not a good solution, there can be 50 queries, so I am looking for something that will wait, check the correctness of the response and execute the next query in the loop.

RYS. 1 - “query” loop
image

RYS. 2 - response

Hi, maybe you need to update your data adding the image url or the name. and add the async image loader extension from [FREE] Async Image Loader Extension - Simple asynchronous image loader with circular image

because if you have 1000 products, you will have 1000 calls

Maybe I’ll use this extension in my application.

But for now I need something that will check if the query was returned, assign it to the appropriate card and perform another query, etc.

Label2.txt is the product id, in the query and response at the same time must be the same to retrieve data.

for each loop, must wait for the data to be retrieved before the next query