1 回答
TA贡献1111条经验 获得超0个赞
然后使用 Promise 函数加载数据,您可以根据需要使用任意数量的 url,只需确保正确连接它们即可。
这里:
window.addEventListener("load", function () {
Promise.all([
loadData("EmployeeInfo", _spPageContextInfo.webAbsoluteUrl + "/_api/web/lists/getbytitle('EmployeeInfo')/items?$select=Title,Age,Position,Office,Education,Degree"),
loadData("Employee2", _spPageContextInfo.webAbsoluteUrl + "/_api/web/lists/getbytitle('Employee2')/items?$select=Title,Age,Position,Office,Education,Degree"),
])
.then(([r1, r2]) => {
const objItems = r1.concat(r2);
var tableContent =
'<table id="employeeTab" style="width:100%" border="1 px"><thead><tr><td><strong>Name</strong></td>' +
"<td><strong>Age</strong></td>" +
"<td><strong>Position</strong></td>" +
"<td><strong>Office</strong></td>" +
"<td><strong>Education</strong></td>" +
"<td><strong>Degree</strong></td>" +
"<td><strong>Source</strong></td>" +
"</tr></thead><tbody>";
添加回答
举报