"Script error. (line 0)" can't see why
"Script error. (line 0)" can't see why
http://live.datatables.net/tabodawo/1/edit?html,css,js,console,output
I am trying to build a table from external api to get exchange rates.
Can't see wht the cause is.
This question has an accepted answers - jump to answer
This discussion has been closed.
Answers
Open the browser's developer tools console and you will see this error:
Looking at the JSON response using the browser's network inspector you are getting this response:
Its a single object not an array of objects. So you will need to use
row.add()
, note their is nos
, to add a single row. You don't have adata
object so you will just add thejson
notjson.data
. See the updated example:http://live.datatables.net/tabodawo/2/edit
Kevin
Thank you Kevin. I am still new to all this but making some progress. I very much appreciate your help. However, why is the rates showing as object. How can I get that to display properly?
It's because it's an object containing currency values - so you'll need to use
columns.render
to determine how to display it. This here just turns it into a string, for example - http://live.datatables.net/tabodawo/6/editColin
Thank you Colin. That was very helpful.