<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <meta http-equiv="X-UA-Compatible" content="ie=edge" />
    <title>Document</title>
    <script src='https://cdnjs.cloudflare.com/ajax/libs/jquery/3.4.1/jquery.js'></script>
</head>
<body>
    
<table border=1>
    <tr>
        <td>Num</td>
        <td>State</td>
    </tr>
    <tr>
        <td><a href="">1</a></td><td></td>
    </tr>
    <tr>
        <td><a href="">2</a></td><td></td>
    </tr>
    <tr>
        <td><a href="">3</a></td><td></td>
    </tr>
</table>

<script>
var promises = [];
var $a = $('a');
$.each($a, function() {
    var $this = $(this);

    var promise = $.get('/rq.php?num=' + $this.text());
    promise.done(function() {
        $this.parent().next().text('done!');
    });
    promises.push(promise);
});



if (jQuery.when.all===undefined) {
    jQuery.when.all = function(deferreds) {
        var deferred = new jQuery.Deferred();
        $.when.apply(jQuery, deferreds).then(
            function() {
                deferred.resolve(Array.prototype.slice.call(arguments));
            },
            function() {
                deferred.fail(Array.prototype.slice.call(arguments));
            });

        return deferred;
    }
}


$.when.all(promises).then(function(schemas) {
     console.log("DONE", this, schemas); // 'schemas' is now an array
}, function(e) {
     console.log("My ajax failed");
});


// $.when.apply($, promises).then(function() {
//    console.log(arguments);
//    console.log('DONE');
   
   
// });
</script>

</body>
</html>