I'm getting the correct stuff in done but the assignment to a variable with an wider scope doesn't work. It worked for e.g. $.each(...) so I assumed, incorrectly, that it'd work here too.
var outee = null;
$.ajax({
url: "http://...",
dataType: 'jsonp',
...
}).done(function (stuff) {
// works well
displayThe(stuff);
// works well (but targets probably a global outee)
outee = stuff;
displayThe(outee);
});
// fail due to outee being nada, nicht, zilch etc.
displayThe(outee);
How can I store stuff for usage outside the scope of the anonymous function in done method that obtained it?
Am I correct to assume that the assignment inside done refers to a global outee? One way to resolve my problem would be not to hide the global outee by the declaration n the method of a var-ed outsee, right? But that's a bad programming style to me. Comments?