How to use dynamic deferred's inside $.when? Got one function ajaxFunction
which returns deferred promise.
function ajaxFunction(image){
var dfd = $.Deferred();
//Ajax of image
return dfd.promise();
}
calling this ajaxFunction based on dynamic condition like
var defs = {};
var someQuerySelector = document.querySelectorAll('image');
for (var i = 0; i < someQuerySelector.length; i++) {
defs[d + 'i'] = ajaxFunction(someQuerySelector[i]);
}
Now I want to use these into $.when()
how to use defs
dynamic keys inside like $.when(defs['d1'],defs['d2'])
. How to use dynamic variables into this. Any change in approach or help will be highly appreciated.
Aucun commentaire:
Enregistrer un commentaire