i have the following javascript object:
var Playlist = function(callback) {
$.ajax({
url:'/playlist'
})
.done(function(data) {
this.html = data;
callback({},this);
})
.fail(function(err) {
callback(err,{});
});
};
for this object, i declared a prototype method:
Playlist.prototype = {
render : function() {
$('#main').html(this.html);
}
};
now, when i create a new object und try to call the 'render' function like this
function renderPlaylist() {
var playlist = new Playlist(function(err, obj) {
obj.render();
});
}
renderPlaylist();
i get a 'undefined is not a function'. it seems not to know the render function, which i declared in the prototype. what am i missing here? thanks for help.