What I want is to run a function only when all the content of a specific div is loaded and all the ajax requests related to that div are completed. So I have this piece of code:
$('#calendar-cont').ajaxStop(function() {
getEventsData();// a function that contains some ajax requests
});
The problem is that the getEventsData() contains some other ajax requests and, for a reason that I don’t understand (but I think is related to the ajax requests inside the getEventsData()) this function is run over and over again.
What am I missing?
ajaxStopis not specific to a certain element, soajaxStopwill be called after the ajax request insidegetEventsData()has finished, so you have an infinite loop.