如何通过javascript / html将获取的数据显示到表中?

问题描述

刚开始使用Javascript / HTML,对实现获取的数据感到困惑。 我想从http://redsox.uoa.auckland.ac.nz/ds/DairyService.svc/news获取数据并将其作为新闻源显示在表格中

到目前为止,我有

    fetch('http://redsox.uoa.auckland.ac.nz/ds/DairyService.svc/news')
        .then(response => response.text())
        .then(data => {
            document.getElementById("newsTable").innerHTML = data;
            
        });

<div id="News">
    <h1><u><b>News</b></u></h1>
    <div id="newsTable">
        <table style="width:100%">
            <tr>
                <th>News</th>
                <th>Image</th>
            </tr>
            <tr>
                <td></td>
                <td></td>
            </tr>
    </div>

我可以将所有数据显示为文本,但不确定如何拆分并显示文本和图像

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)