0

I have a strange problem with Datatables.

On localhost(port 8080) I’m trying to populate a Datatable thought ajax and JSON. The call (and the html page of Datatable itself) is on classic asp on IIS. After a lot of retries I manage to get Datatables to work. As usual F12 developer tools were always on to help me on messages and errors. When I closed F12, the table was not populating at all. It shows only the message loading…

I’ve try to clear cache, to prevent from caching, nothing. When I reopen F12, it works like a charm. Here is the code from client-side:

var oTable = $('#table_list').dataTable({
    "bJQueryUI": true,
    "sDom": 'l<"H"Rf>t<"F"ip>',
    "ajax": {
        "url": " list_new.asp",
        "type": "POST",
        "data": function (d) {
            d.col1 = ID;
            d.col2 = name;
            d.col2 = date;
        }
    },
    "columns": [
        { "data": "ID" },
        { "data": "FullName" },
        { "data": "Locations" },
        { "data": "date" },
        { "data": "status" }
    ]
});

Any thoughts?

Since this is my first post in StackOverflow, if I forget something, please let me know.

Educos
  • 1
  • 3
  • Have you tried on different browsers? Also, with developer tools closed, refresh the page and use Fiddler to capture the network traffic and check if `list_new.asp` is successful? – Mohsin Mehmood Jun 21 '18 at 17:39
  • Hello Moshin,thanks for your reply. Unfortunatly I can't check it with different browser (a lot of pages inclassic asp on IIS), but I'll try Fiddler and let you know. Once again thanks for your reply. – Educos Jun 21 '18 at 20:00
  • After inserting the following tag in meta data, the Datatables populate successfully. But the style of the page becomes a mess. `` – Educos Jun 22 '18 at 08:15
  • @Educos this is most likely an issue with IE compatibility version which you can change from F12 developer tools. Hence it works when the developer tool is open. You have to add some response headers in IIS to make it compatible with older IE version. The meta tag you are using now makes it EDGE compatibile. Check this link for IE8 compatibility https://blogs.msdn.microsoft.com/mike/2008/10/15/configuring-iis-to-work-around-webpage-display-issues-in-internet-explorer-8-0/ – Niladri Jun 23 '18 at 07:30
  • If it's Internet Explorer and it only works with dev tools open, it's probably this: https://stackoverflow.com/a/6713651/405015 – thirtydot Jun 24 '18 at 20:55
  • If I open dev tools, console display : _The attached page targets documents mode 7. Some console APIs and features may not be available._ @thirtydot you are right. For debugging, there was a `console.log` and when i remove it, the page works. – Educos Jun 25 '18 at 06:13

1 Answers1

0

When removing console.log() form JavaScript code, the table populates successfully.
Thanks to thirtydot the problem was solved.
ref : https://stackoverflow.com/a/6713651/405015

Educos
  • 1
  • 3