On async
call I am receiving a HTML component which I want to replace with another div
.
Here is my main HTML:
<div id="main">
<H1>Name</h1>
<div>Content wil reside here</div>
</div>
How can I replace div id="main"
child with the response.data
HTML response. Is there any possible way to do so?
Here is the async call:
axios.post(url, newState).then(response => {
console.log(response.data);
}).catch(error => {
console.log(error);
console.log(error.response.data);
});
It's returning me a complete div
:
<div>
Hi
<p>Hello</p>
</div>