2

理由はわかりませんが、私の Javascript は非常に遅く、適切に終了するまでに 5 分ほどかかります。ページを更新したり、一部のリクエストが処理されなかったりすることがあります。

私はすでに async:true を使用しており、処理が少し速くなることを期待していますが、そうではありません。#myspace 内に各要素を保存するために使用しているコードを次に示します。

cn = document.getElementById("myspace").childNodes;
        for (var t = 0; t < cn.length; t++) {
            if (cn[t].nodeType == 1) {
                var n = {
                    id: cn[t].id,
                    left: cn[t].style.left,
                    top: cn[t].style.top
                };
                $.ajax({
                    data: n,
                    url: "/Application/Ajax/__ajaxProfile.php?a=SavePosition",
                    type: "post",
                    cache: true,
                    async: true,
                    success: function (e) {}
                })
            }
        }
        e("Please wait for everything to save, it might take more than a minute.");

        setInterval(function () {

        if ($.active == 0) {

            $('#close-modal').show();

        }

        }, 10);

処理が非常に遅い理由と、これに対する適切な解決策を知っている人はいますか?

4

1 に答える 1