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

111
Visualizações
Is there a way to run a function asynchronous with the rest of the page from inside of a jquery success function?

So I have a webpage that loads a list of content from a php server-side script, sorts it on the client side and adds the final list to a div in the webpage. When loading the page a button press pulls up the list something like

  searchRequest = $.ajax(
  {
        type: "GET",
        // blah blah blah 
        async: true,
        success: function(data)
        {
              sortTheData(data)
              addTheDataToThePage(data)


        }
  });

After a bit of testing I figured out that the jquery ajax request was working async as it was supposed to, but the page was still hanging during loading while sorting the list.

What I want to do is have the sorting and adding functions in the success function start at that point, but run without blocking the rest of the page from running smoothly (ie in its own thread, but still adding its results to the page at the end).

Ive tried running the sort & add parts in an async function, as well as wrapping it in a promise return, but the page still seems to hang whenever it reaches the sorting stage.

Do I need to use some sort of Web Worker to do this, or is there a way of doing it in pure javascript?

about 4 years ago · Juan Pablo Isaza
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