Ajax request extremely slow
I don't know why, but my Javascript is extremely slow and takes like five
minutes to finish properly, you sometimes refresh the pages and some
requests haven't been processed.
I already used async:true hoping that it will process a little bit faster
but it doesn't. Here's the code I am using to save each element on inside
#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);
Anyone knows why it's been processed so slowly and a decent solution for
this?
No comments:
Post a Comment