3 ms·
I wonder why I should not simply use a good old php include for the first example
by ulrischa 2y ago
I wonder why I should not simply use a good old php include for the first example
- meiraleal 2y agothis seems to work with static assets, so no need for a old php server. But also you don't need much more than those lines of JS: document.addEventListener('DOMContentLoaded', () => { const t = document.querySelector('template[data-hmpl]'); t && fetch(t.dataset.src, { method: t.dataset.method }) .then(res => res.text()) .then(html => t.outerHTML = \`<div>\${html}</div>\`)});