Invalid JSON Response from javascript sourced data

Invalid JSON Response from javascript sourced data

spike200spike200 Posts: 1Questions: 1Answers: 0

I have this code:

  const dataSet = [
    {
      name: 'Tiger Nixon',
      position: 'System Architect',
      salary: '$320,800',
      start_date: '2011/04/25',
      office: 'Edinburgh',
      extn: '5421'
    }
  ];

  $('#racesTable').DataTable({
    data: dataSet,
    columns: [
      { data: 'name', title: 'Name' },
      { data: 'position', title: 'Position' },
      { data: 'office', title: 'Office' },
      { data: 'extn', title: 'Extn.' },
      { data: 'start_date', title: 'Start date' },
      { data: 'salary', title: 'Salary' }
    ]
  });

And this is working, my data is showing propelry, but alert with "Invalid JSON response" keeps showing. I have only this one on my javascript currently. I was trying to use example from documentation, with just an array, without object keys, and results is the same - table is working, but error still appears.

What can I do? How can I debug wrong json from variable?

Cheers

Answers

  • colincolin Posts: 15,237Questions: 1Answers: 2,598

    Hi @spike200 ,

    I just tried that here, and I'm not seeing any JSON response errors. It might be being generated elsewhere in your code. Would you be able to give an example please where you see that error?

    Cheers,

    Colin

  • kthorngrenkthorngren Posts: 21,117Questions: 26Answers: 4,916

    You would need to be using the ajax option to see this error. As Colin mentioned do you have more code that might be using the ajax option?

    Kevin

This discussion has been closed.