AJAX - Displaying a table

Discussion in 'Scripts' started by bigcougar, Feb 27, 2012.

to remove all ads.
  1. bigcougar

    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?
  2. Edge

    Edge Member

    can you post a link to a test page?

Share This Page