JSFiddle - React, Tailwind, and code Playground
HTML
<input id="btn_Search" type="button" value="Search" />
<br><br><br>
<div id="firstDivision">default firstDivision content</div>
<br><br><br>
<p>Ajax status:<span id="ajax_status"></span></p>
JavaScript
$('document').ready(function() {
$("#btn_Search").click(function (e){
e.preventDefault();
console.log("clicked");
$( "#firstDivision" ).load( "/echo/html/", function( response, status, xhr ) {
if ( status == "error" ) {
var msg = "Sorry but there was an error: ";
$( "#ajax_status" ).html( msg + xhr.status + " " + xhr.statusText );
}else if ( status == "success" ) {
var msg = "Success: ";
$( "#ajax_status" ).html( msg + xhr.status + " " + xhr.statusText );
$( "#firstDivision" ).text("this should come from ajax - just simulating here");
}
});
});
});