Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

152
Visualizações
Facing some problems with jQuery AJAX call configuration

I have an AJAX call that is loading data from a database. I have the following AJAX setup

$(function () {

    $.ajaxSetup({
        headers: {
            'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
        }
    });
    
    $(document).ajaxStart(function () {
        $("#placeholder").removeClass('d-none');
    });

    $(document).ajaxSuccess(function () {
        $("#placeholder").addClass('d-none');
    });

});

It's working pretty well until I use the input to search by word / letter. The input is using input event to be triggered but the problem is the following:

When I write something in the Input, the placeholders appear until it shows the results and then hide, but after that when I click outside the Input (remove the focus from the input), the placeholders appear for milliseconds and hide again (blink)

I've made a lot of test and the conclusion is that it's not happening because of the input event. Here is a thread (by me) for this problem.

Which jQuery event can I use to avoid input event trigger when click outside the input

What can cause this behaviour? I really need help.

about 4 years ago · Santiago Trujillo
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda