i know its elementary javascript question but still it'll be of great help. i'm stuck in following function:
Utils.get = function (action,index,callback){ var books = Alloy.createCollection('books'); books.fetch({success: function(){ var authors = Alloy.createCollection('authors'); authors.fetch({success: function(){ callback(); },}); },}); };in above function i'm using restsql.js so both fetch need to be done "remotely". i could return true, but i'm using callback.
PROBLEM : above function returns callback 2 times. i just need to RETURN ONCE after both fetch are done.
(return true also returns twice...) is there any way that after both fetch are done, function returns callback only once?