I'm trying to create a dynamic collapsible list. The data is pulling through the ajax and listing out just fine, but the jQuery
mobile styling is not being applied and I have no clue how to correct this. I've tried several things that I have found on the internet, but nothing seems to work. Here is the code that I'm using.
function button_directory(){
section_directory = document.getElementById("section_directory");
$("#display_area").fadeOut("slow", function(){
display_area.innerHTML = "";
title_bar.innerHTML = "DIRECTORY";
$("#display_area").fadeIn("slow", function(){
});
var directoryURL = protocol + domain + "query.php?sid="+code;
$.ajax({
url: directoryURL,
dataType: "json",
success: function(members) {
if(members.length > 0) {
temp = '<div data-role="collapsible-set" id="collapsible">';
$.each(members, function(index, value) {
temp +=
'<div data-role="collapsible" data-collapsed="true">'+
'<h3>'+value.firstName+' '+value.lastName+' - '+value.title+' '+value.type+'</h3>'+
'<p><strong>Company:</strong> '+value.company+'<br>'+
'<strong>territory:</strong> '+value.territory+'<br>'+
'<strong>Clients:</strong> '+value.clients+'</p>'+
'</div>';
});
temp +='</div>';
display_area.innerHTML = temp;
$("#collapsible").trigger("create");
//$("#display_area").find("div[data-role=collapsible]").collapsible();
//$("#display_area").trigger('create');
} else {
return false;
}
}
});
});
}