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

  • Home
  • SEARCH
  • 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 8775537
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T18:49:27+00:00 2026-06-13T18:49:27+00:00

I have created a loading screen plugin. The scenario is that i am doing

  • 0

I have created a loading screen plugin. The scenario is that i am doing page navigation using ajax loading. So before loading a page using ajax, i would show an loading screen using the code $('body).loadingMask('show') and once the page is loaded completely loaded, i would remove the loading screen using the code $('body').loadingMask('hide).

The problem is that, there is some delay in retrieving the target dom element inside the plugin.

This is the general structure of the code

$('body').loadingMask('show');
$.ajax({
url : 'views/next.html',
    async : false,
success : function(content, textStatus, jqXHR) {
$('body').append(content);
},
error : function(content, textStatus, jqXHR) {
throw "Unable to load template. Please check the path and name of the template"
}
});
$('body').loadingMask('hide');

The problem is that , inside the show function of the loadingMask plugin, There is a delay in retrieving the target dom element(i.e body) . So pratically, the code $('body).loadingMask('show') runs only after the ajax page is finished loading.

In order to make it work , i have added a time delay. Which seems to work fine.

This is the modified code

$('body').loadingMask('show');
setTimeout(function(){
$.ajax({
url : 'views/next.html',
    async : false,
success : function(content, textStatus, jqXHR) {
$('body').append(content);
},
error : function(content, textStatus, jqXHR) {
throw "Unable to load template. Please check the path and name of the template"
}
});
},500);
$('body').loadingMask('hide');

Now i can see the loading screen, while the page loads.

  • 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-13T18:49:28+00:00Added an answer on June 13, 2026 at 6:49 pm

    If you remove async:false you can call your plugin withing the ajax success, right after the content gets added.

    async:false is deprecated and often leads to unforeseen problems

    $('body').loadingMask('show');
    $.ajax({
        url: 'views/next.html',
        success: function(content, textStatus, jqXHR) {
            $('body').append(content).loadingMask('hide');
        },
        error: function(content, textStatus, jqXHR) {
               /* likely need to remove maske here and add something to content to advise user*/
            throw "Unable to load template. Please check the path and name of the template"
        }
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a splash screen that i am using it when i am loading
I have created a reusable class that fades in a loading message and indicator
I want a splash screen to show while the application is loading. I have
I have created a custom cell for loading into a table. The interface is
I have created a custom view with a XIB file and are loading the
I have a restfull webservice that requires loading trained model files and to create
I have created some JQuery that will expand a div 'popup' on hover and
I have an animated .GIF image that I created with http://ajaxload.info/ and some editing.
I created a swf that I have on my website. The swf loads xml
How do I create a loading screen that can be reused at any given

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.