JSFiddle - React, Tailwind, and code Playground
HTML
<input type="button" value="Case 1" id="one" />
<input type="button" value="Case 2" id="two" />
<div id="content1"></div>
<div id="content2"></div>
JavaScript
$("#one").click(function() {
// First throw in the customized loading animation
$("#content1").html('<img src="http://i.imgur.com/ZK0sq.gif" />');
// Then make the Ajax call.
$.ajax({
url: '/ajax_html_echo/',
success: function(data) {
$('#content1').html("your data1 would go here");
}
});
});
$("#two").click(function() {
// First throw in the customized loading animation
$("#content2").html('<img src="http://i.imgur.com/U4ZP6.gif" />');
// Then make the Ajax call.
$.ajax({
url: '/ajax_html_echo/',
success: function(data) {
$('#content2').html("your data2 would go here");
}
});
});