I have a JSP with a Struts 2 include:
<div id="data">
<s:include value="list.jsp"/>
</div>
list.jsp has an iterator inside.
With JavaScript I have 3 functions that make an Ajax call to different actions and web services but the 3 functions refresh the same Java object list:
function firstCall(product) {
// an ajax call
.done(function(html) {
$("#data").append(html);
});
}
function secondCall(product) {
// an ajax call
.done(function(html) {
$("#data").append(html);
});
}
function thirdCall(product) {
// an ajax call
.done(function(html) {
$("#data").append(html);
});
}
And i have another function that iterate a string array of products:
function iterate(productos){
for(i=0;i<productos.length;i++){
firstCall(productos[i]);
secondCall(productos[i]);
thirdCall(productos[i]);
}
}
My problem is that I need these three methods to be asynchronous because each takes like 10 seconds. =(
There is a better way to do this?