gpt4 book ai didi

javascript - 如何从ajax成功将动态数据设置为其他html

转载 作者:行者123 更新时间:2023-11-28 03:05:05 25 4
gpt4 key购买 nike

我有一个来自一个 html 的 ajax 成功响应,但我想将此 ajax 响应的动态数据设置为另一个我该怎么做这是我的 ajax 报告

    success: function(data) {
console.log(data);
for (var i=0; i<data.data.length;i++)
{
$("#eng-jobs").append('<tr id="enginner-job'+[i]+'" class="price-table">' +'<td class="colspan-4">' + '<a href="job.html" class="title">' +data.data[i].job_name+'</a>' +'</td>' + '<td class="colspan-4">' + '<a href="job.html" class="location">' +data.data[i].location+'</a>' +'</td>' + '</tr>' );
}
window.location="enginnering.html";
}
});

这将生成一个动态表,现在我想在其他 html 中设置这个表,我已经把我的代码放在了

<table class="table table-striped">
<thead style="display: table-header-group;">
<tr>
<td class="colspan-4">Position</td>
<td class="colspan-4 location-head">Location</td>
</tr>
</thead>
<tbody id="eng-jobs">
<!-- Table Body Data -->
</tbody>
</table>

但我什么也没得到 任何帮助

最佳答案

将此代码写入ajax 成功。

 window.open("enginnering.html");

关于javascript - 如何从ajax成功将动态数据设置为其他html,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32961708/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com