I have the following function that does between 3-5 AJAX requests. What I wanted to do was save the responses of the requests in a single object.
However, they all end up overwriting the last key that was added to the object. So I end up with an object of null properties, except for the last one, which has invalid data ( the data of the request that finished last, probably ).
Is there a solution to this, or am I doing something wrong?
getKeyData: function () {
for (var key in ABC.PrintReport.keyList) {
k = ABC.PrintReport.keyList[key].Report_Key;
Ext.Ajax.request({
url: ABC.Core.servicePath + '/task/' + ABC.PrintReport.processInstanceID + '/report/' + ABC.PrintReport.keyList[key].Report_Key + '?portalID=' + ABC.Core.portalID,
success: function (response) {
ABC.PrintReport.reportData[k] = Ext.JSON.decode(response.responseText)[0];
}
});
}
},