JSFiddle - React, Tailwind, and code Playground
HTML
<button id="demo">Click here</button><br/><br/><br/>
<input type="file" id="upload" />
JavaScript
$(function () {
$('#demo').click(function () {
$.ajax({
type: "POST",
url: "/echo/json/",
data: "jsonText",
dataType: "json",
//async: false
}).done(function (msg) {
$("#upload").click();
}).fail(function(jqXHR, textStatus, errorThrown){
alert(textStatus);
});
//$("#upload").click();
});
});