25 lines
554 B
JavaScript
25 lines
554 B
JavaScript
let essays = document.querySelectorAll(".divLink");
|
|
|
|
essays.forEach((e) => {
|
|
let link = e.querySelector("a").href;
|
|
let id = link.split("=")[2];
|
|
|
|
e.addEventListener("click", () => {
|
|
fetch("director.php", {
|
|
method: "POST",
|
|
headers: {
|
|
"Content-Type": "application/x-www-form-urlencoded",
|
|
},
|
|
body: "ajaxId=viewEssay&id=" + id,
|
|
})
|
|
.then((response) => {
|
|
return response.json();
|
|
})
|
|
.then((data) => {
|
|
if (!data["html"]) return;
|
|
|
|
openModal(data["html"]);
|
|
});
|
|
});
|
|
});
|