I have a ajax like as below:
$.get('/api/get-data)
.then(function (res) {
console.log(res);
});
And i want write a loop to get data, like this:
while (true) {
$.get('/api/lastbids/' + auctionId)
.then(function (res) {
console.log(res);
});
}
I want set delay between every request, i can use setinterval but i want when get response finished, after 500ms send another request for data.
.then()in jQuery?/api/lastbids/, than in callback delay 500ms, than call same function again.