llhd/wwwroot/webnew/pages/layanan/layanan.js

25 lines
748 B
JavaScript

function getQueryParam(name) {
const urlParams = new URLSearchParams(window.location.search);
return urlParams.get(name);
}
document.addEventListener("DOMContentLoaded", function () {
const jenis = getQueryParam("jenis");
if (jenis) {
fetch(`/WebNew/Layanan/GetData?jenis=${jenis}`)
.then(res => res.json())
.then(data => {
document.getElementById("content").innerHTML = `
<div class="container mt-5">
<h2>${data.judul}</h2>
<ul>
${data.deskripsi.map(d => `<li>${d}</li>`).join("")}
</ul>
</div>
`;
});
}
});