My ajax code is
var auto_refresh = setInterval(function () {
$.ajax({
type: 'post',
url: 'lib/nav.php',
data: 'c=autchk',
success: function (result) {
$('#test-div').html(result);
},
error: function (jqXHR, textStatus, errorThrown) {
// I don't know how to display error message
console.log('Error: '+jqXHR+' '+textStatus+' '+errorThrown);
}
});
}, 9000);
The request is sometimes cancelled before reach the timeout. In the chrome log, the status of cancelled request is stalled. Then I read the explanation that lead me to this
Queueing. The browser queues requests when:
- There are higher priority requests.
- There are already six TCP connections open for this origin, which is the limit. Applies to HTTP/1.0 and HTTP/1.1 only.
Stalled. The request could be stalled for any of the reasons described in Queueing.
Is the problem because of that or something else?
EDIT :
I test the code in 3 browsers
I did not see any cancelled request in Microsoft Edge. There are more in Chrome than Firefox.