≡

DT 3 ajax hangs on network errors

DT 3 ajax hangs on network errors

aklietzaklietz Posts: 12Questions: 0Answers: 0

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:

  1. Display a paginated table that uses SSP over a network.
  2. Kill the web server.
  3. 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

Sign In or Register to comment.