I make an ajax call that returns json data and tells me what html template to load and also the data needed to populate the template. If I load the template outside of the ajax call the data populates fine, however if i try and load the html within the ajax call, i see the html elements have loaded, but i am unable to populate them.
$.ajax({
type: "POST",
url: "http://some-url/items-json/item_data.json",
dataType: "json",
async: true,
success: function( data ) {
// template_name will be an html file like template_10.html
// #player-template is the div id i want to load it into
$('#player-template').load(data.template_name);
// these elements get created from the dynamic template that gets loaded above
$('#ques_intro').html(data.ques_intro);
$('#question').html(data.question);
}
});