I got some help using .promise().done on an xml parser, here. This method is fine if you combine the .promise().done() with the parser function. What I really wanted to do, though, was define the parser function separately up top, then execute it later in the code, and the apply the promise().done() to it there:
var xmlparse = function(){
$.get("file.xml), {}. function(xml) {
$('photo',xml).each(function(i){
...
array filling
.....
});
});
});
xmlparse().promise().done(function(){...
I've learned that line above doesn't work; I need to pass an object that the original function acted on. If xmlparse() was changing a div, for example, I'd say $('div').promise().done(). But what exactly can being passed for an XML parser that doesn't change any HTML structure? (This goes back to the original solution; I'm glad it works, but I don't understand quite why.) Any help's appreciated.