This works for me. My ajax returns a bunch of h3, which I insert in the collapsible div and add the p tag for the content.
$(document).ready(function(){
$.get(my_url, function(data) {
var content = $('div[data-role="content"]').html(data);
$('h3').each(function(h3_element) {
var coll = $('<div class="ui-collapsible-contain" name="blog" data-role="collapsible" data-collapsed="true">');
coll.append($(this));
coll.append($('<p>'));
content.append(coll);
});
content.trigger( "create" );
});
});
source
share