I’ve modified my codes based on Jory Hogeveen comments, and it solved my problem. What I do is, to not using the regular loop but instead use a recursive function that calls itself after it finishes calling for the request. For those who are looking for the same answer, please see below.
var users_info = <?php echo json_encode($usersarray); ?>;
console.log(users_info);
$=jQuery;
var each="";
j = 0;
function nextAjax(i) {
var data = {
'action': 'delete_orphan_users',
'user_id': users_info[i]
};
$.post(ajaxurl, data, function(response) {
n = new Date($.now());
m = n.getHours()+':'+n.getMinutes();
$("#status").prepend(m+' '+response);
j++;
$("#deletedusers").html(j);
if( j==users_info.lenght ){
location.reload(); //current batch finished, reload screen to get another batch of users
} else {
nextAjax(j);
}
});
}
console.log('Start')
nextAjax(j);