I am running a loop within a click event handler doing the following:
- run heavy computation (takes 1-3s)
- call
$("<li> + data + </li>").appendTo($("#results"))
The problem is, that the DOM is not refreshed until the loop has terminated. Running the loop for 100 iterations this takes too long, I would like to give a result every time I computed one.
How can I force the DOM to be refreshed?