How can i call multiple time ajax request using on console log.
i have Reply XHR to working fine but i need multiple request send using console log. any idea?
if you loop looks something like this:
for(var i=0; i<10; i++){
$.ajax({
//
success:function(data){
$("#p" + i + "_points").html(data);
}
});
}
it will not work as i will end up being the last i value in the loop; You need something like below
for(var i=0; i<10; i++){
(function(index){
$.ajax({
//
success:function(data){
$("#p" + index + "_points").html(data);
}
});
})(i);
}
The closure along with the passing of i will keep number value for that call.
of course there will need to exist elements with ids 1-10 or whatever number you use so:
<element id="p1_points">
<element id="p2_points">
<element id="p3_points">
...