JSFiddle - React, Tailwind, and code Playground
HTML
<h1>This is all that is in the html</h1>
<button id="trigger_ajax">Push me</button>
JavaScript
$("#trigger_ajax").bind("click", function() {
$(this).remove();
$.ajax({
url: "/echo/html/",
type: "POST",
data: {
"html": "<h2>Hello World - I am from the ajax request</h2>"
},
success: function(returned_data) {
$("body").append(returned_data);
}
});
});