R
R
runapa2021-08-12 09:17:57
AJAX
runapa, 2021-08-12 09:17:57

How to update html table with php loop?

There is a regular html table, the content of which is generated in php and displayed in a loop in the markup. The question is: is it possible to somehow update the contents of the table using only the existing markup? If yes, how to do it? Now I send an Ajax request, then I hide the main table and substitute another table generated by the backend in its place, although in fact my request simply changes the contents of the array without touching the structure. Here also it would be desirable to simplify the scenario somehow.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
N
Nadim Zakirov, 2021-08-12
@zkrvndm

If the table structure does not change, you can parse the table obtained through AJAX through DOMParser , and then stupidly through querySelectorAll and the for loop to go through all the cells and update the data in your main table.

V
V Sh., 2021-08-12
@JuniorNoobie

You can do something like this (quickly):

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question