There is the following code that is used in the chrome extension:

$.ajax({ url: "https://sitename.com", dataType: 'json', async: false, success: function(data) { $.each( data, function( key, val ) { 

Which makes simultaneous requests to the api method, there are 24 of them.
But, api gives only 8 requests per second.
How can I force requests to be sent for example with a delay of 130ms?

    1 answer 1

    Since async: false , requests are not simultaneous. They take turns.

     $a = ["url1", "url2", ... "url24"]; $.each($a, function(k, v){ setTimeout(function(){ $.ajax({ url: v }); }, k * 125); }); 

    125 is 1/8 second; k is the array index, but it’s better to have a variable with an increment

    • But the question was how to limit their number in a second. The $ .ajax is probably not such an option, and you have to make the delay layer yourself, through which you call $ .ajax. - Uranus
    • Added by. I hope there is an opportunity to do so. - Mrak