Khắc phục lỗi datatables warning table id role-list ajax error năm 2024

Some of our customers who use the lazy load option in WooCommerce Product Table see an error message in a box, which says 'DataTables warning: table_id=wcpt_--- - Ajax error. For more information about this error, please see https://datatables.net/tn/7' (or similar).

Why am I getting this error?

The error means that an invalid response was returned from the AJAX (i.e. lazy load) request. This is normally caused by an AJAX error or conflict in your theme or another plugin, which interferes with the output of the AJAX request.

A valid lazy load request and response looks like this:

Page loads → product table loads without any data (i.e. just the headings) → AJAX request fired → products load → product data returned to browser in JSON format → JSON data added to table → Spinner icon disappears.

An invalid request and response looks like this:

Page loads → product table loads without any data (i.e. just the headings) → AJAX request fired → products load, but an error is triggered or something interferes with JSON output → DataTables doesn't find a valid response and displays an error message.

How to fix the DataTables Ajax error

The simplest way to fix this error is to disable lazy load.

If you need to use lazy load because of the number of products in your table, then you can troubleshoot the error as follows:

  1. Temporarily switch to a default theme (e.g. TwentySeventeen) and disable all the plugins apart from WooCommerce and WooCommerce Product Table.
  2. Try to load the table again, and see if it fixes the error.
  3. If it fixes the error, reactivate everything one by one to find the cause of the problem. If it doesn't fix the error, please send us a support request with your WordPress login details and a link to the page with the product table.

DataTables (the jQuery plugin used by WooCommerce Product Tables) has provided this documentation on how to further troubleshoot the error. This involves looking in the Developer tools to inspect the AJAX response.

On January 12, 2016, Microsoft ended support for Internet Explorer versions prior to version 11 . It is strongly recommended that you upgrade to a new operating system if your current system does not support Internet Explorer 11.

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Yup, we are aware of this issue. This issue is applicable to websites that do not have permalink structure defined on the Settings -> Permalink page.

We are going to fix it shortly https://github.com/aamplugin/advanced-access-manager/issues/262.

Regards,

Hi

On both sites which this is happening for me the permalink is set to post name.

P.S. I just updated to 6.9.8 and it is still happening. I cleared all caches and re-submitted the permalinks twice.

  • This reply was modified 1 year, 2 months ago by applejack1923.

Hi Vasyl,

I also got this error (again)…

DataTables warning: table id=route-list – Ajax error. For more information about this error, please see http://datatables.net/tn/7

Hello @jvalks and @applejack1923 ,

I would need a bit more information on this. We already adjusted our implementation to cover all know scenarios. Can you please check your PHP error log for any error, warnings or notices?

Also, what do you see in the your browser dev tool for the API request to the /aam/v2/roles endpoint?

Keep me posted.

The strangest thing is that it disappears after say 3 or 4 times.. As soon as I encounter it, I will try to see if I can find any error for you to troubleshoot.

roles?fields=user_count.permissions&_=1677503989253

404

xhr

jquery.min.js:2

  • This reply was modified 1 year, 1 month ago by applejack1923.

I did some further testing and if I de-activate another plugin the error message does not appear. The plugin is

https://en-gb.wordpress.org/plugins/swift-performance-lite/

Thank you @applejack1923 for the info. This is unusual, unless the Swift Performance Lite messing around with the RESTful API endpoints.

I’m not familiar with the Swift Performance Lite plugin, but when I install and activate it, I can’t reproduce the issue.

So 404 typically means that the API endpoint is not found. So, I’m suspecting that Swift Performance Lite may do some sort of caching for the RESTful API and you probably can disable that particular caching in their settings.

Keep me posted.

It’s not easy to troubleshoot… The only thing I could find in the Apache log:

Order: new to old

.263163 [NOTICE] [73228] [T0] [x.x.x.x:64117:HTTP2-877

APVH_websitename.nl:443] oops! 503 Service Unavailable

.263167 [NOTICE] [73228] [T0] [x.x.x.x:64117:HTTP2-877

APVH_websitename.nl:443] Content len: 92, Request line: ‘POST /wp-admin/admin-ajax.php HTTP/1.1’

.263169 [INFO] [73228] [T0] [x.x.x.x:64117:HTTP2-877

APVH_websitename.nl:443] Cookie len: 613, wordpress_sec_3a31d67b7b2bbf9120cc80a9f81225e0=adminname%7C1678977715%7CvXx2Xr4RcRIC5swwLrXlvCXlFi8scBTMcQbZPlTL9q1%7Ce1826a2fdb7ed59087361a4516101bc22d5622beae95e02a675f6771029c42a1; wordpress_test_cookie=WP%20Cookie%20check; wordpress_logged_in_3a31d67b7b2bbf9120cc80a9f81225e0=adminname%7C1678977715%7CvXx2Xr4RcRIC5swwLrXlvCXlFi8scBTMcQbZPlTL9q1%7C7f2b6b0bbe04cd9d82359cd1c667690971ecae7d61317eb0b3a82d0a0146f9d5; wp-settings-1=deleted%3Dundefined%26ampimgsize%3D%26amplibraryContent%3Dbrowse%26imgsize%3D%26libraryContent%3Dbrowse%26posts_list_mode%3Dlist%26editor%3Dtinymce; wp-settings-time-1=1678804917

.384300 [INFO] [73228] [T0] [x.x.x.x:64117:HTTP2-875

APVH_websitename.nl:443] connection to [uds://usr/local/lsws/extapp-sock/APVH_gjbljxpj_Suphp80.sock] on request

1, confirmed, 1, associated process: 111336, running: 1, error: Connection reset by peer