JSFiddle - React, Tailwind, and code Playground
HTML
<form action="./cgi-bin/my_script.py" method="post" enctype="multipart/form-data" name="fname">
<input type="submit" id="submit" value="Submit" />
</form>
<div id='content'></div>
CSS
#loading { display:none; }
JavaScript
$(document).ready(function() {
$("form").submit(function(e) {
e.preventDefault();
$('#content').html('put your loading html here').load('/ajax_html_echo/', function(response, status, xhr) {
//This is the callback. You can check for error here.
//For example if (status == 'error') alertTheMedia();
});
});
});