tdc
tdc

Reputation: 5464

How to change the contents of an HTML table with php + javascript

I have a page which, when a user visits it, makes a MySQL call to a DB, and then puts that information into an html table presented to the viewer by the time the page initially loads.

I want to allow more advanced refinement options, like filtering by name, age, etc.

when the user submits their refinement options, how would I clear out the "old" data in the HTML table that is displayed on page load, and then re-populate it with the "new" data PHP returns?

Will this require DOM manipulation via JS? How can I specify the target node to echo out my PHP into?

Thanks :)

Upvotes: 0

Views: 217

Answers (3)

Yehonatan
Yehonatan

Reputation: 3225

Ajax, Yes, document.getElementById

Upvotes: 0

zambesianus
zambesianus

Reputation: 1249

When the data you wish to display is available from a server and is not yet in the browser, you can make a AJAX call to go to the server and pull the data back from it for display.

A common use case for this is when you are displaying live information which could be periodically updated

What is ajax?

Want to start learning ajax?

Upvotes: 1

rgeddam
rgeddam

Reputation: 81

Dynamic java script will help you to incorporate the changes into html page.

AJAX will be the best solution to do this.

Upvotes: 0

Related Questions