I'm trying to loop an ajax request for 10 times. I've noticed some weird errors, such as int being 10, 10 times. I've searched and found it's related to AJAX async. I want to have something that waits until the ajax request is finished and then continues.
Thanks in advance.
do{
    var int=0;
    $.ajax({...},
        success:function(response){ int++; },
    });
    alert(int);
}while(int<10);
 
     
     
     
    