I want to attach a variable into my HTML. I am using .html to do this but doesn't seem to be working.
Also am I right to use the pageinit event? The page is dynamic , the content is different depending on the choice from a list on the previous page.
Maybe append would be a better choice? Im unsure.. Any advice?
Here is my JS file
$(document).on('pageinit','#details-page', function(){
var details_view = "";
$(function() {
$.getJSON('js/bands.json', function(data) {
details_view += '<div><p>Content goes here</p></div>';
});
});
$('#detail_content').html(details_view);
});
Here is my HTML.
<div data-role="page" id="details-page">
<div data-role="header" class="header">
</div>
<div data-role="content" id="detail_content">
// **I want the details_view variable content to go here**
</div>
<div data-role="footer" class="footer" data-position="fixed">
</div>
</div>