I am currently calling external php files and displaying them within specific div. This is all done using the standard jQuery $.ajax call.
However an issue arises when one of the pages being pulled in attempts the following getJSON call, resulting in an infinite loop:
function getContacts() {
if ($('body.all-contacts').length){
$.getJSON('assets/data/contacts.json', function(data) {
var template = $('#contacts-template').html();
var info = Mustache.to_html(template, data);
$('.contact-list').html(info);
});
}
};
The above function is called as follows:
$(document).ajaxComplete(function(){
....
getContacts();
....
})
I've also tried using ajaxStop() instead of ajaxComplete() but the issue persists.
getContacts()insideajaxCompleteajaxComplete(). For instance, create a functionsetUp()that wil load all your external files. Once setUp() is finished, callgetContacts(). (create a callback : stackoverflow.com/questions/8516191/jquery-create-callback )