Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8541239
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T11:47:13+00:00 2026-06-11T11:47:13+00:00

I am working on JQuery UI, i am blocking UI on click on anchor,

  • 0

I am working on JQuery UI, i am blocking UI on click on anchor, on clicking i am loading some url into a div thats why i am blocking UI to prevent clicking then unblocks it,
the problem arising is that Blocking is occuring one one second(or less) and suddenly unblocks and in this case the request URL didn’t load completly and user is able to click another anchor

$('.carousel-main .carousel ul li a').each(function () {
            $(this).click(function (e) {

    $.blockUI({ message: "Please wait..." }); 
                e.preventDefault();
                var hrefvalue = $(this).attr('href');
                CallAction(hrefvalue, true);
                $.unblockUI()

            });
        });

The above code is working fine, i also tried using below code in place of $.blockUI but nothing happens in using below code

var timeout = setTimeout(function() {
    $.blockUI({ message: "Please wait..." }); 
}, 2000);

How can i set timeinterval for this situation

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T11:47:14+00:00Added an answer on June 11, 2026 at 11:47 am

    Your code when beautified looks like this:

    $('.carousel-main .carousel ul li a').each(function () {
        $(this).click(function (e) {
    
            $.blockUI({
                message: "Please wait..."
            });
            e.preventDefault();
            var hrefvalue = $(this).attr('href');
            CallAction(hrefvalue, true);
            $.unblockUI()
    
        });
    });
    

    It means that $.blockUI and $.unblockUI are called one after another without the interpreter going into the event loop. Probably even if your CallAction is blocking (but I assume that it isn’t since you wouldn’t need to block the UI then) the $.blockUI wouldn’t get a chance to do anything.

    Try removing the $.unblockUI from this function and see if the $.blockUI call actually does what you want. If it does then you’d have to call $.unblockUI() in some callback function that is called after whatever you are waiting for is done – not in the same function where you’re calling the $.blockUI.

    You didn’t show the code for which you want to wait, but assuming that you are doing an AJAX call inside CallAction then you would need to call the $.unblockUI in the callback of that AJAX call.

    (As a sidenote – keep in mind that the AJAX request may never finish and hang your UI forever so you should add some timeout to unblock the UI after some time.)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i am working with jquery for animate a div. i want to control speed
I'm working with jquery mobile library... Couple of days a go...I ran into a
I'm currently working with jQuery 1.4.2 and jQuery UI 1.8.2. I'm experiencing some weird
Working jQuery, what I'd like to perform is something similar to the following: $('sometag').children().wrap('<div></div>');
While working with jQuery and PHP a problem occurs with loading new data from
I have a working jQuery script that will cycle through some images. However, when
I'm working with jQuery for the first time and need some help. I have
I have a working jQuery page redirect. I want to fade into the page
I'm binding a click event to a div element, which is created after clicking
I pulled a (working) jquery dropdown from some website and I don't really understand

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.