I understand Ajax is asynchronous, but I still fail to understand how object scoping and the use of how javascript likes to use this works.
mylibrary = { 
        my_variable: 0,
        my_function: function() {
                $.ajax({
                        url: "/theinternet",
                        method: "POST",
                        data: {
                                // things
                        },   
                        success: function(response) {
                                this.my_variable += 1; // How do I access my_variable?
                                console.log("HOORAY!");
                        },   
                        error: function(error) {
                                console.log("ERROR");
                        }    
                // }).bind(this); this doesn't work.
                }).bind(this);
        }   
}
How on earth am I suppose to access my_variable inside the success function of the ajax call?
It seems like this would be a pretty common thing people need to do, no?
 
     
     
     
    