JSFiddle - React, Tailwind, and code Playground

by Phil Brown

HTML

<div id="div1"><h2>Let jQuery AJAX Change This Text</h2></div>

<button>Get External Content</button>

JavaScript

$(document).ready(function(){
  $("button").click(function(){
    $.ajax({
    	url: "/echo/html",
      method: 'post',
      dataType: 'text',
      data: {
      	html: 'I am the external content'
      },
      async: true,
      success: function(result){
      	$("#div1").html(result);
    	}
    });
  });
});