Possible Duplicate:
Why doesn't this closure have access to the 'this' keyword? - jQuery
function class1() {
    this.url = 'http://en.wikiquote.org/w/api.php?action=query&format=json&prop=revisions&titles=Albert_Einstein&rvprop=content&callback=?';
    this.f = function() {
        $.getJSON(this.url, function() {
            console.log(this.url);
        });
    }
};
var obj = new class1();
obj.f();
Instead of printing the url, obj.f() prints "undefined" to the console. Why is this happening and what can I do to prevent this behaviour?