Data tables not working for Ajax response, giving e[i] is undefined. Not able to resolve issue ?

Data tables not working for Ajax response, giving e[i] is undefined. Not able to resolve issue ?

datatestlorddatatestlord Posts: 6Questions: 3Answers: 1
edited September 2018 in Free community support
var Table;
var Set;

function mainTable(){   
    Table = "";
    Set = "";
    
    $.ajax({
        "url": "MyURL", 
               "type" : "POST",
               "success": function(json) {
            alert(JSON.stringify(json));
            var tableHeaders;
            $.each(json.columns, function(i, val){
                tableHeaders += "<th>" + val + "</th>";
            });
            
            $("#Table").empty();                
           Set = json.data;
            
          Table =  $('#myTable').DataTable({
                'responsive': true,
                'scrollX': true,
                'scrollY': '350px',
                'data': Set,
                'order': [1, 'asc']
                });
        },
            "dataType": "json"
    });
}

My json response is fine, but it is giving e[i] is undefined error ? Not able to solve this

Answers

  • datatestlorddatatestlord Posts: 6Questions: 3Answers: 1

    resolved the issue.

  • Boilermaker80Boilermaker80 Posts: 19Questions: 6Answers: 0

    Can you share your solution? I'm getting the same problem on some platforms with some browsers, but it works fine on others.

  • colincolin Posts: 15,146Questions: 1Answers: 2,586

    Hi @Boilermaker80 ,

    That's odd you're only seeing it on some browsers, and some platforms, if this stuff works on one, I'd expected it to work on all others.

    It would be worth creating a new thread and linking to your page, or creating a test case. Information on how to create a test case (if you aren't able to link to the page you are working on) is available here.

    Cheers,

    Colin

  • colincolin Posts: 15,146Questions: 1Answers: 2,586

    Aha, just saw that you did :)

This discussion has been closed.