Skip to content Skip to sidebar Skip to footer

Unwanted Comma In Xhr Response Ending Up In Table's Cells

I have an XHR response that looks something like this: [ [ 'e33222', '1730-06-27', 'Lewis Morris', [ 'Edward Wynne; ', '

Solution 1:

So loop over the data before you set it in the datatable and format the data so it is not an array.

var results = [
    [
        "e33222",
        "1730-06-27",
        "Lewis Morris",
        [
            "Edward Wynne; ",
            "William Bulkeley"
        ]
    ],
    [
        "22222",
        "2222-06-27",
        "foooo Mooooo",
        [
            "foo bar; ",
            "foo baz"
        ]
    ],    
]

results.forEach(function (record) {
  record[3] = record[3].join('')
})
console.log(results);

Post a Comment for "Unwanted Comma In Xhr Response Ending Up In Table's Cells"