My HTML page primarily displays a list of pages retrieved from server.
I chose to implement this is in two parts
Render the page without the list of pages with spinner.
After the page is loaded I am making an AJAX call to retrieve the page list as JSON
I am using jQuery as My javascript library
I get the JSON over AJAX which I need to convert into HTML and display in the page accordingly.
I have not done similar translation before so I would like to know what would be the optimal way to go ahead and transform JSON to html.
I did some research. I could see using some library or iterating each element and constructing the divs.
which would be the better one?
Sample of my JSON would be like
{
SomeID: 12345,
someName: somefile,
totalPageNum: 5,
pages: [ //Array of pages
{
pageFields: [ // Array of page fields
{
field: {
id: 1,
type: someType,
name: someFieldName,
value: Some Field Value
},
coordinates: {
x: 105,
y: 543
}
}
],
somePagenumber: 1,
somePageURLurl: /location/to/page1
}
]
}
Thanks for reading!!!