显示控制台日志中的数据

时间:2020-01-09 16:41:18

标签: php jquery html

我正在尝试将数据库显示为html页面。数据出现在我的控制台中,但是我不知道如何在html表中显示它。我不确定需要添加到console.log(数据)中的功能才能显示到页面上。这是我到目前为止所拥有的:

    <button class="btn btn-primary" id="btn">Get Code</button>

    <table class="table table-bordered">
    <thread>
    <tr>
    <th>ID</th>
    <th>City</th>
    <th>Country</th>
    <th>Rating</th>
    </tr>
    </thread>

    <tbody id ="tdata">

    </tbody> 
   </table>

    <script>
    $(function () {

    $.getJSON("php.php", {tableName:"travel"}, function(data){
      if (data["code"] == "error"){
        console.log(data["message"]);
      }
      else{

        console.log(data);
      }
    console.log("returned hh");
    });

    });
    console.log("returned");
    </script>

    </body>
    </html>

0 个答案:

没有答案