jquery ã§è¤æ°ã® ajax å¦çãçµãã£ããããå¦çããããã¨ã
var requests = [ { url: 'http://...', settings: { ... } }, { url: 'http://...', settings: { ... } }, { url: 'http://...', settings: { ... } } ]; var dfds = []; for (var i =0; i < requests.length; i++) { req = requests[i]; dfd = $.ajax(req.url, req.settings); dfds.push(dfd); } $.when.apply($, dfds).done(function() { //å¦ç })
ã£ã¦ããã¨dedsã®å¦çããã¹ã¦çµãã£ããç¹å®ã®å¦çãè¡ããã¨ãã§ããã
jQuery.ajax ã®ã³ã¼ã«ãè¡ã£ã¦ãæ»ãå¤ã¨ãã¦å¾ããã jQuery.Deferred ã dfds é
åã«æ ¼ç´ãã¦
$.when.apply($, dfds).doneãã§å
¨ã¦ã® Ajax ã³ã¼ã«ã®çµäºãå¾
æ©ãã¦ãã
ãªãã»ã©ã