I conduct a for loop
for every request that is sent..
for (let k = 0; k <= 1000; k++) {
$.ajax({
url: `127.0.0.1/index?value=${k}`,
method: `get`,
beforeSend: function() {
// any action..
},
success: function(response, status, xhr) {
$('#response').append(response);
}
});
}
Nevertheless, as the for loop progresses from 0 to 1000 (this number may vary, it's just for illustrative purposes.) the user interface becomes unresponsive, and the responses to requests are not displayed in the DOM.
<div id="response"></div>
How can I improve this? Ideally, each ajax request should dynamically display the result in the response div (or synchronously)
Is there a straightforward solution that can help me achieve this?