In the code below I am calling loadAuthorsList function which should then pass its information on to the loadTemplate function. But I am being told by firebug that 'this.loadTemplate' is not a function. Why and how do I fix it?
var LI = {
sFI: x,
loadAuthorsList: function () {
myApp.showPleaseWait();
//for later
$('#records_table').find('tr:gt(0)').remove();
jQuery.ajax({
url: this.sFI.getServiceRoot('A'),
type: 'POST',
dataType: 'json',
data: {},
beforeSend: this.sFI.setModuleHeaders,
success: function (data) {
this.loadTemplate('AuthorTemplate', '#author_records', data)
},
complete: function () {
}
});
},
loadTemplate: function (templateName, selectorName, inputData) {
var jsPath = this.serviceFrameInstructors.getServiceRoot('LearnoogleInstructors');
jQuery.ajax({
url: jsPath.slice(0, -4) + 'js/templates/' + templateName + '.html',// + intArea,
cache: false,
success: function (value) {
var personTemplate = $.templates(value);
var html = personTemplate.render(inputData);
$(selectorName).html(html);
}
});
}
};