I try to send multiple requests on the same url. I send users.length requests to the server because i need to ban all those users are in this array. The problem is that this code returns me always the same data. I know that i must use promises but i can't convert this code.
for(i = 0; i<selected_users.length; i++)
{
$.post(webRoot + "ban-user",
{
"user-id" : selected_users[i],
"action-type" : action_type
},
function(data,status){
if(status == "success")
{
alert(data);
}
}
});
}