JSFiddle - React, Tailwind, and code Playground
HTML
<p>Ajax de forma sĂncrona.</p>
<button id="teste">Clique aqui</button>
JavaScript
$(function () {
function buscando_dados() {
$.ajaxSetup({async: false});
$.post('/echo/html/', { html: 'teste' }, function (dados) {
alert(dados);
});
$.ajaxSetup({async: true});
}
function buscar_dados() {
buscando_dados();
alert('prosseguindo');
}
$("#teste").on('click', function() { buscar_dados(); });
});