DT 3 ajax hangs on network errors
DT 3 ajax hangs on network errors
aklietz
Posts: 12Questions: 0Answers: 0
in Bug reports
Description of problem:
DataTables 3 wrongly treats network errors (status===0) as an abort. This causes ajax processing to hang waiting for a request that it thinks was never completed.
To reproduce:
- Display a paginated table that uses SSP over a network.
- Kill the web server.
- Go to the next page.
Notice it hangs.
Fix:
--- a/datatables..js
+++ b/datatables.js
@@ -720,7 +720,7 @@
let responseData = xhr.responseText;
let statusText = 'success';
if (xhr.status === 0) {
- return; // aborted
+ statusText = 'error'; // Network error
}
else if (xhr.status === 204 || method === 'HEAD') {
statusText = 'nocontent';
The comment is wrong. A call to xhr.abort() never fires xhr.onreadystatechange
Replies
Agreed - fix committed. Many thanks for flagging that up.
Allan
Thank you!
-Alan