I have been learning JS for a week because I want to do pagination that does not require the entire page to be loaded. I have successfully accomplished this task. However, the display in html is not as expected as everything is crumbled together, and it seems my For loop in JS is not working as expected.
I am fetching the data from a Flask/Python view function and pushing it to the JS before displaying in the HTML template. The orange part should take the photo (this is not in the code), the blue part should have the names, the green-yellow part should have the announcement, and the grey part should have the publisher's name. My pagination displays two persons and as you can see in the output, the two are crumbled together. I seeking assistance in rewriting the code for it to display appropriately. Thank you in advance.
Here is the code.
view function
@app.route('/api/data')
def data():
`deaths = current_user.followed_deaths().filter(Deceased.burial_crenation_date >=` [`datetime.today`](https://datetime.today)`().date()).order_by(Deceased.timestamp.desc())` `latest_deaths = jsonify( [{ 'first_name': i.first_name, 'middle_name': i.middle_name, 'last_name': i.last_name, 'announcement': i.death_announcement, 'publisher': i.publisher.username } for i in deaths ])` `return latest_deaths`
html and JS code