Problems populating a datatable with JSON data from Last FM.

Problems populating a datatable with JSON data from Last FM.

decodedcreativedecodedcreative Posts: 3Questions: 1Answers: 0

Hi,

I am currently working on a personal project using Last FM's API to display data on my music tastes. The first task I've given myself is to create a table which displays my Recently Played Tracks. I'm using the DataTables plugin as I want to refresh the table's data on the fly as I play more tunes, using AJAX.

I seem to be experiencing some problems when trying to populate my DataTable with the data received from the JSON Feed. If I use JQuery's map method to create a new, cleaner JSON object array with only the data I need then I can access the data fine, as shown in this fiddle:

http://jsfiddle.net/8rekuLaf/2/

However the problem with this approach is that I want to refresh the table on the fly as new data becomes available and so I think this extra step will prevent me taking advantage of ajax.reload to refresh the table. Therefore I've tried to go back and populate my table directly from the JSON feed but it has proved problematic as shown here:

http://jsfiddle.net/8rekuLaf/3/

Any help would be great. I know I'm nearly there!

This discussion has been closed.