So I have a function which looks like this:
function Students(){
// Function add:
// Returns: add page
this.add = function(){
// Get template
$.get('view/students/new.html', function(template){
// Templating
var html = Mustache.to_html(template);
// When document ready, write template to page
$('document').ready(function(){
$('#container').html(html);
});
});
};
};
When I try to call it's add function like so:
Students.add();
I get the error:
Uncaught TypeError: Object function Students(){...}has no method 'add'
What gives?