JSFiddle - React, Tailwind, and code Playground
HTML
<button id="withAjax">
click me to execute ajax try to open the file dialog
</button>
<button id="noAjax">
click me to execute to open the file dialog directly
</button>
<hr>
Here is the file dialog
<input type="file" id="file-upload">
JavaScript
$('#noAjax').on('click',function(){
$('#file-upload').click()
});
$('#withAjax').on('click',function(){
$.ajax({
type: "post",
url: "/echo/json",
data: {
newProjectName:'foo',
csrfmiddlewaretoken: "tok"
},
success: function(data){
alert("callback")
$('#file-upload').click()
}
})
})