I have a function that triggers an ajax request for a route, see:
var getInstituicoesSemUsuario = function(tipo)
{
var resultado = "";
$.ajax(
{
url: "{{path_for('instituicao.sem.responsavel')}}",
data: "tu=" + tipo,
type: "GET",
async: false,
success: function(resposta)
{
resultado = resposta;
}
});
return resultado;
}
With the option async
set to false
you can get the return of the getInstituicoesSemUsuario()
function, however, Google Chrome issues the following warning:
Synchronous XMLHttpRequest on the main thread is deprecated because of its detrimental effects to the end user's experience.
In a nutshell, a synchronous call seems to affect the end-user experience.
However, if I remove the option async
or set it to true
the warning disappears, but I can not get the result of the request.