JSFiddle - React, Tailwind, and code Playground
HTML
<form id="login" action="/echo/html/" method="post">
<input type="text" name="html" value="test"/>
<input type="submit"/>
</form>
<div id="log"></div>
JavaScript
$('#login').submit(function(e) {
// check if the event is fired
$('#log').append($('<p>event submit</p>'));
// simulate async
setTimeout(function() {
// submit after 2 seconds
$('#login')[0].submit();
},2000);
// don't submit
e.preventDefault();
return false;
});