Plugin.prototype = {
init: function () {
var instance = this;
$.ajax({
type:'get'
}).done(function(data) {
//Within closure scope (`this` will no longer be the function)
instance.yourOtherFunction(data);
});
},
yourOtherFunction: function (data) {
//Back into plugin scope (`this` will be the function again)
data.doSomethingWithMe();
}
};