javascript - Browser aborting Ajax requests sporadically without returning any errors -
this question has answer here:
in project (php symfony 2) lot of ajax requests in every page. i'm having lot of problems them, because looks browsers (tested in google chrome , firefox) aborting requests without giving me error. i've done clean page test can causing issue , error persists. i've tried test doing 10 requests inside for
loop (i believe don't have problem it, right?).
here code:
<!doctype html> <html> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8" /> <title>test page</title> </head> <body>test page. <script type="text/javascript" src="/js/compressed_jquery-1.8.2.min_1.js"></script> <script type="text/javascript"> $(document).ready(function() { (var = 0; < 10; i++) { $.get('/i18n/javascript/pt.json', function(data) { console.log(data); }); } }); </script> </body> </html>
and here screenshot of requests result in firebug:
as can see, requests completed , others not. browser completes 10 requests without errors. can causing this?
i've tested solutions, i'm pretty sure it's windows, apache or php configuration issue. today i've configured vm in machine virtualbox running ubuntu 13.04 (raring ringtail) apache 2.2 + php, , no errors happenned, proving nothing javascript, html or php code. not sure configuration issue. how discover configuration?
could fit needs, sending request 1 one should avoid server rejecting parallel requests:
$(document).ready(function () { var tot = 30; //to simulate 30 requests (function request(i){ if(i === tot) return; $.get('/echo/html/?'+i, function (data) { console.log("success"); }).always(function() { request(++i) }); })(0); });
Comments
Post a Comment