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

179
Visualizações
jQuery unblockUI() is triggered by ajax redirect

I've got an icon with a process attribute so when I click on the icon an ajax submit is triggered.

Now, as long as the icon's action is running I want to block the page with jQuery's blockUI() function. It works perfectly fine with regular submits (without ajax), but on ajax submits the page is only blocked for a short time so it is falsely possible to make a second submit before the first one is finished.

I analyzed the network traffic in Firefox and noticed the following:

On a regular submit (without ajax) the POST-method's answer is "302 Found" while on an ajax submit a redirect is performed so the answer here is "200 OK" with the answer message <partial-response><redirect url="myURL"></redirect></partial-response>.

I debugged and realized that at some point I end up in PrimeFaces' core.js file with the function PrimeFaces.ajax.ResponseProcessor.doRedirect(a); which again calls window.location.assign(b.getAttribute('url')).

With this assign, the blockUI is lost.

My question: What can I do so the blockUI is not lost on an ajax redirect?

I am using the following code in my xhtml-file:

<p:ajaxStatus onstart="onGlobalAjaxStart()" oncomplete="onGlobalAjaxComplete()" />

The function onGlobalAjaxStart() does the following:

$.blockUI.defaults.overlayCSS = {};
let message = $('#blockUI').attr('pt:message'); // gets the text for the blockUI message
$.blockUI({ message: message});

The function onGlobalAjaxStart() calls $.unblockUI() (among others).

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