I have created a simple plugin using jquery that loads the contents by using post request from server. All the info is defined on data-attr on div with name loader. It's successfully loading contents. However resulting data may contain more loading div tag. What I'm looking is way that once the first run is finished completely, check again if there are div with name=loader, if there are any run the loop again and do it until there are no div with name=loader are present in body section. I tried wrapping the code in a for loop that runs twice but it's not working because loop finishes immediately.
Once the data is loaded using plugin I'm changing the name of that div to loaded so that in next runs it won't be available for reloading.
Sudo code may look like this