Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

178
Views
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
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!