Skip to content
Advertisement

work on each td each one apart inside tr loop when loading data from json file

I created a code to convert json data to html table using javascript and ajax: (column 1 is text, column 2 is link, column 4 is image link)

Data:

JavaScript

This is the code, it work well, but on the table result, I want to hide column 2 and put the link in column 2 in an anchor in column 1 so the Title become clickable link, and put the image link on column 4 into src so the picture shown on the cell.

JavaScript

Advertisement

Answer

Instead of iterating through the cells, if you know the position of the columns in the array you can hard code the row.

JavaScript

And take out the second column in the table instead of hiding it

JavaScript
User contributions licensed under: CC BY-SA
10 People found this is helpful
Advertisement