<div id="myContent">
    <h2 > Can AJAX Replace This Text ?</h2>
</div>
<button id='actbutton'> Change Text </button>
body
{
  font-family:"Trebuchet MS", Helvetica, sans-serif
}
document.getElementById('actbutton').onclick=function()
{
  var xhr = new XMLHttpRequest();
    xhr.open("GET", "https://codepen.io/prasanthmj/pen/ICgxE.html", true);
    
    xhr.onreadystatechange = function ()
    {
        if (xhr.readyState==4 && xhr.status==200)  
        {
            document.getElementById("myContent").innerHTML=xhr.responseText;
        }
    }
    xhr.send();
}

External CSS

This Pen doesn't use any external CSS resources.

External JavaScript

This Pen doesn't use any external JavaScript resources.