AJAX - Displaying a table

bigcougar

New Member
My page retrieves data from a MySQL database. The PHP script outputs a string of values that should produce a table on the page.


So far I have tried the following approaches without success

1. I get the PHP script to output the whole table as a response string to a request.

Echo "<table><td><tr>value1...........etc.....</table>";
Then I insert the response text into a <div> on the page using

innerHTML = response text (JavaScript)

This way I get the data out as a string of values.

2. I have the opening and closing table tags on the page <table></table>.
I then insert the rows again using innerHTML.


If I run the PHP script in 1 on its own, I get the table that I want on thescreen. I just cannot insert it in the place that I want on the page.


I know the methods I use are wrong. Any suggestions?
 
Top