Unable to get past DataTables Error Message

Unable to get past DataTables Error Message

James CobbanJames Cobban Posts: 1Questions: 0Answers: 0

I am having a problem accessing a web site which imports from https://cdn.datatables.net/ and keeps raising an alert "DataTables warning: table id=OntarioLocator5 - Token expired, please refresh page".

https://canadagenweb.org/specialprojects/ontario-locator/

I have tried refreshing dozens of times. I have also opened the page in a private tab so there is nothing in the cache or the history. I have tried it on Firefox 118.0.2 on both Ubuntu and Android, and Version 118.0.5993.88 (Official Build) snap (64-bit) on Ubuntu.

The administrator of the web site does not know how your product works and is therefore unhelpful and less knowledgeable about web development than I am. She cannot reproduce the problem on her browser. I have over 50 years of software development experience and over 30 years of web development experience. Yes I put up my first web site less than one year after Tim created the CERN site. It ran on NCSA httpd because Apache had not been made available yet. And before the existence of the Web in 1985 I saw the value of a presentation system with thousands of pages containing news, help, and input forms, connected by links and created a server that hosted them shared by a 20,000 terminal intranet. I am trying to help the site administrator out but I cannot set a breakpoint at that alert so I can't figure out WHY you are generating this unhelpful message. Please advise me how to debug this!

If the token is expired why not ask me for a new token rather than kicking me out of the service?

For alternate means of contacting me see https://www.jamescobban.net/home.html

Replies

  • allanallan Posts: 63,494Questions: 1Answers: 10,470 Site admin
    edited October 2023

    Hi,

    The error message actually isn't coming from DataTables. We are just displaying the error that the server is responding with.

    The DataTable is configured to make an Ajax request to https://canadagenweb.org/wp-admin/admin-ajax.php which is responding with:

    {
        "draw": 0,
        "recordsTotal": 0,
        "recordsFiltered": 0,
        "data": [],
        "error": "Token expired, please refresh page",
        "debug": ""
    }
    

    DataTables sees the error message and thus displays it. The idea behind that is not that it would be useful for the end user, but rather for the system administrator to see that there is a problem and take action. My guess as to why the site admin is not seeing that error is that they might be logged into their WordPress install and perhaps that is causing the token used for them to be valid. Indeed, I don't see a token in the request, so I'm not sure what it is meant to be. Perhaps if they tried on a different browser or in incognito mode, it might cause it to happen.

    I'm afraid there is nothing I can do to resolve the error - it is a server-side issue. Possibly it needs a token from the client-side, and if that is the case, I can certainly help the admin sent it as part of the DataTables request, and happy to do that.

    edit My guess is that it is a permissions issue in WordPress and the way the table data feed is configured (that might be in a plug-in - I'm not sure, I see reference to "WP Data Access Premium"). My guess is that the data is only served to a logged in user. The error message looks generic enough that it might be what WP throws when a non-authenticated request comes in.

    Allan

Sign In or Register to comment.