Possible Duplicate:
Variable doesn’t get returned JQuery
I'm not sure what the problem could be here, but I am losing the result value, of my JQuery Ajax .get call. (code simplified for problem)
File : SomeJSFile.js
var MyApp = function () {
this.GetAThing = function(url){
var result = "";
$.get(url, function (data) {
result = data;
alert(data); // Alert works and 'data' looks great!
result = data;
});
alert(result); // nothing, no value
return result; // no good since it has no value
};
return this;
};
I am using this file in a basic html page for testing.
Have already read: jQuery async ajax query and returning value problem (scope, closure)