I am using Handlebars for a site I am building for rendering the sites content and language control. To make things easier I want to make a function where I can pass in the the "page" as an argument.
Here is the function I have started on:
config.renderLanguage = function(page) {
var soruce = $('#body').html();
var template = Handlebars.compile(soruce);
// "this" is my language file.
$('#body').append(template(this.language_file.page.body));
};
I assume that it won't work because when "page" comes in, it is a string, resulting in an error. So the question is really how I can convert the argument so it can be used in the dot notation.