I've written a javascript class in which there is a function which
makes a ajax request.

But the callback function of this $.ajax don't know the objects
variables. Why is that.

It looks something like this:

function FileView(fbId, rootFolder, showFolders, type) {

        this.tmpVar = 'somuch';

        FileView.prototype.choseFolder = function(folderId, type,
showFolders)
        {
                alert(this.tmpVar); // displays somuch

                $.ajax({        type: "POST",
                        url: "file.php",
                        data: "actions",
                        success: function(msg) {
                                alert(this.tmpVar); // displays undefined
                        }
                });
        }
}

What am I doing wrong. It could be something with my class - it's the
first time I'm doing oop in javascript.

Reply via email to