Js fix Progress bar stuck

(function progressbarStuckTryRefresh() {
                var reloadUrl = '@Url.Action("BatchPayment", "Bulk", new { batchId = Model.Batch.Id })';
                var retryCount = 5;
                var count = 0;

                function checkProgressStatus() {
                    var pg = $("#ProgressBarStatus");
                    if (!pg) {
                        return -1;
                    }

                    var progress = pg.attr("aria-valuenow");
                    if (progress && progress < 100) {
                        document.location = reloadUrl;
                        return -1;
                    };
                    return 1;
                };

                setTimeout(function check() {
                    if (checkProgressStatus() < 0 && (++count) <= retryCount) {
                        check();
                    }
                },
           500);

            })();

你可能感兴趣的:(Js fix Progress bar stuck)