javascript - Ajax request extremely slow -
i don't know why, javascript extremely slow , takes 5 minutes finish properly, refresh pages , requests haven't been processed.
i used async:true hoping process little bit faster doesn't. here's code using save each element on inside #myspace.
cn = document.getelementbyid("myspace").childnodes; (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 save, might take more minute."); setinterval(function () { if ($.active == 0) { $('#close-modal').show(); } }, 10);
anyone knows why it's been processed , decent solution this?
var n_array=new array(); (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 }; n_array.push(n); } } $.ajax({ data: n_array, url: "/application/ajax/__ajaxprofile.php?a=saveposition", type: "post", cache: true, success: function (e) {} })
should way faster, , produce less traffic. ofc you'll have change processing code little...
Comments
Post a Comment