0

I want that the second function(lastfunction) inside foreach function will get called after 1 minute during each loop. i have tried different ways but nothing working out. its a javascript page. how to handle it?

if (t == '/routing') {
    _noSide();
    $('.sending').unbind("click").click(function() {


        var first = $("#first").val();
        var second = $("#second").val();
        var data = {
            'first': first,
        };

        $.post(apiUrl + "abc.php?nextfunction", data, function(res) {
            if (res.code == 200) {
                $("#myModal-100").modal('hide');
                if ((res.users).length) {
                    (res.users).forEach(function(vl, i) {

                        var to = vl.add;
                        console.log(to);
                        console.log(amount);
                        var dataa = {
                            'to': to,
                            'second': second,
                        };

                        setTimeout($.post(apiUrl + "abc.php?lastfunction", dataa, function(res) {
                            if (res.code == 200) {
                                notification(res.status);
                            } else {
                                notification(res.status);
                            }
                        });, 6000);

                    });

                }
            }
        });
    });

}
Satpal
  • 132,252
  • 13
  • 159
  • 168
Suman Raj
  • 21
  • 1
  • 3

0 Answers0