Я не могу получить «Табличный» для отображения таблицы с данными. Протестировали его на Chrome и Edge.
main. js
let jsonURL = './readAllUsers.php';
var table = new Tabulator("#example-table", {
ajaxURL: jsonURL,
ajaxResponse: (url, params, response) => {
console.log(response.data);
return response.data;
}
index. html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>My Table</title>
<link href="/node_modules/tabulator-tables/dist/css/tabulator.css" rel="stylesheet">
</head>
<body>
<div id="example-table"></div>
<script type="text/javascript" src="/node_modules/tabulator-tables/dist/js/tabulator.js"></script>
<script src="./main.js"></script>
</body>
</html>
readAllUsers. php возвращает json данные ... если я исследую вывод журнала консоли из "ajaxResponse" выше, я вижу тестовые данные:
Array(6)
0: {id: "1", firstName: "Lou", lastName: "Pieters", email: "lou@gm.com", phone: "0123456789", …}
1: {id: "2", firstName: "John", lastName: "Snow", email: "john@gm.com", phone: "0129871234", …}
2: {id: "3", firstName: "Buck", lastName: "Rogers", email: "buck@gm.com", phone: "0129986677", …}
3: {id: "4", firstName: "Tom", lastName: "Tom", email: "tom@gm.com", phone: "0129986767", …}
4: {id: "5", firstName: "Dick", lastName: "Richards", email: "dick@gm.com", phone: "0129983344", …}
5: {id: "6", firstName: "Harry", lastName: "Potter", email: "harry@gm.com", phone: "012999900", …}
length: 6
__proto__: Array(0)