I'm trying to get the return value of a utility method I wrote using jquery:
function loadFrames(coords, spritesheet) {
return $.ajax({
type: "GET",
url: coords,
dataType: "xml",
success: function(xml,code,obj) {return parseFrameData(xml, spritesheet);}
});
}
So, this method receives two arguments, opens a file (the one pointed to by the "plist" argument) and runs the parseFrameData method. The latter returns an array of objects.
I would like to use this the following way:
var frames = loadFrames('player.xml', 'spritesheet.png');
but I don't find the way to say "return the value of the method you called on line starting with "'success:' "...