<!DOCTYPE html>
<html lang='uk'>
<body>
<p>Тег script з атрибутом src створюється та розміщується в документі.</p>
<p>Файл PHP повертає виклик функції з об’єктом як параметром.</p>
<p id="demo"></p>
<p>Спробуйте змінити властивість таблиці з "customers" на "products".</p>
<script>
const obj = { table: "customers", limit: 10 };
let s = document.createElement("script");
s.src = "jsonp_demo_db.php?x=" + JSON.stringify(obj);
document.body.appendChild(s);
function myFunc(myObj) {
let txt = "";
for (let x in myObj) {
txt += myObj[x].name + "<br>";
}
document.getElementById("demo").innerHTML = txt;
}
</script>
</body>
</html>