My code:
$('#cars').live('pageinit',function() {
var msg = "";
$.ajax({
url: 'http://192.168.23.20/php/getcar.php',
dataType: 'jsonp',
jsonp: 'jsoncallback',
success: function(data){
msg += '<div data-role="collapsible-set">';
$.each(data, function(i,v){
msg += '<div data-role="collapsible">';
msg += '<h3>'+v.carName+'</h3>';
msg += '<p>'+v.cardesc+'</p>';
msg += '</div>';
});
msg += '</div>';
$(".car").after(msg);
}
});
});
The output is displayed as plaintext instead of JQM accordion. Is there any workaround to do JQM accordion on pageinit?
if you are going to create accordion list dynamically or modify dynamically then you need to refresh that particular accordion to get JQM style and effects that you can achive by
$('.selector').collapsibleset('refresh');may be this(not tested) works for you.