The following code loads html content from a file (i used this thread)
The callback (success) function runs when the response arrives, and it doesn't run in the scope of the loadWithoutCache method, as that has already ended.
You can use the context property in the ajax call to set the context of the callback functions:
$.fn.loadWithoutCache = function (){
$.ajax({
url: arguments[0],
cache: false,
dataType: "html",
context: this,
success: function(data) {
$(this).html(data);
}
});
}