javascript - How to show HTML received after POST? -


maybe that's easy, cannot find solution. have endpoint, accepts post requests specific values , returns html. how should request show received html in browser?

in simple english, i'd have <a> tag, specified http method, headers etc. used during clicking on it.

this 1 way it.

fetch(url)     .then(res => res.text())     .then((html) => {         // change content of element html received         el.innerhtml = html          // append html body         document.body.innerhtml += html;     }) 

Comments

Popular posts from this blog

Is there a better way to structure post methods in Class Based Views -

performance - Why is XCHG reg, reg a 3 micro-op instruction on modern Intel architectures? -

jquery - Responsive Navbar with Sub Navbar -