The transparent DIV/waiting message may not be displayed in IE10

Here is a DIV container that serves as a transparent background with a loading message.

This is the HTML code for the DIV container:

<div id="generatingexcel" style="display:none; position: fixed; width: 100%;height: 100%; z-index: 999; top: 0; left: 0; background:rgba(25, 25, 25, 0.5);">
    <div style="color: #fff; font-size: 24px; position: absolute; left: 500px; top: 400px;">
        <strong>Generating Excel Please wait....</strong>
    </div>
</div>

When making an ajax call, the first step in the success function of the ajax call is to set the Transparent DIV display property to 'block'. Once the execution is complete, the display property will be set back to 'none' for the Transparent DIV.

$("#generatingexcel").css("display", "block");

$.ajax({
    type : "GET",
    url : url,
    contentType : "application/json; charset=utf-8",
    success : function (msg) {
        //code
    },
    async : false,
    error : function (err) {
        alert(err);
    }
});

$("#generatingexcel").css("display", "none");

While this works well in Firefox, there seems to be an issue in IE10 where the transparent DIV and loading message do not appear. To debug this, I added an alert() message after setting the display property to block, which made the transparent DIV visible in IE10. However, once I removed the alert, the transparency effect disappeared again.

$("#generatingexcel").css("display", "block");
alert("Wait");

If you have any insights on why this behavior occurs or if something crucial is missing in the setup, please let me know.

Answer №1

It is not possible to add two conditions at the same time. If you attempt to do so, only the last condition will be executed. You can also utilize the show()/hide() methods to display or hide your element.

Recommended Solution:

$("#generatingexcel").show();

$.ajax({
    type : "GET",
    url : url,
    async : false,
    contentType : "application/json; charset=utf-8",
    success : function (msg) {
        $("#generatingexcel").hide();
    },
    error : function (err) {
        alert(err);
    }
});

Alternative Solution:

To address issues with Internet Explorer compatibility, you can add the following code snippet to the <head> tag:

<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE9" >

Additional information and solutions can be found here.

UPDATE:

If the overlay is not displaying in IE, try including a setTimeout() method with a duration of 1 millisecond. This workaround has been tested with varying sizes of JSON data.

Please consider implementing the following solution:

$(document).ready(function(){
    $("#generatingexcel").css("display", "block");
    setTimeout(function(){
        $.ajax({
            type : "GET",
            url : url,
            cache: false,
            async : false,
            contentType : "application/json; charset=utf-8",
            dataType: "json",
            success : function (msg) {
                $("#generatingexcel").css("display", "none");
            },
            error : function (err) {
                alert(err);
            }
        });
    },1)
})

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Display a particular div upon clicking a specific link, while concealing the other divs

As a beginner in the world of jQuery and coding, I'm encountering some difficulties that I need help with. My goal is to have the 'Vlogging' link activated and show 'Details 1' when the page loads. Then, upon clicking on either &a ...

Is there a difference between innerHTML strings and their corresponding strings in JavaScript?

I am facing an issue with a code snippet that seems to have an unusual error. The following code is a simplified version to demonstrate the strange behavior. <html> <head> <script type = "text/javascript"> window.onload = fun ...

"Troubleshooting a callback problem in jQuery involving JavaScript and AJAX

UPDATE3 and FINAL: The problem has been resolved with the help of Evan and meder! UPDATE2: To clarify, I need the existing function updateFilters(a,b) to be called, not created. My apologies for any confusion. The issue with the code below is that udpate ...

What could be causing the jQuery code to not run properly in my jasmine test?

I am currently using Rails 3.2.8 along with the jasmine-rails gem. Here are the specifications in my Gemfile related to the jasmine set-up: jasmine (1.2.1) jasmine-core (>= 1.2.0) rack (~> 1.0) rspec (>= 1.3.1) selenium-webdriver (>= ...

Is it feasible to utilize the .fadeTo() function in jQuery multiple times?

I need some help with writing a script that will display a warning message in a div tag every time a specific button is pressed. I chose to use the fadeTo method because my div tag is within a table and I want to avoid it collapsing. However, I'm noti ...

"Retrieve text from a span element using Selenium after it has been dynamically loaded

When I load a price using Ajax and display it in a span element, the hardcoded price of 0 appears in the HTML. However, on the page, I see a different price being displayed. The issue is that my test fails to capture the new price obtained through the Ajax ...

How can I modify my code to ensure that trs and th elements are not selected if their display property is set to none?

I am currently working on creating a filter for my pivot table, but I am unsure of how to dynamically calculate the sum of each row/column based on whether they are displayed or not. If you need any other part of my code, feel free to ask. To hide employee ...

How come the picture extends beyond the borders of its parent container when I expand the width?

Despite my efforts, I haven't been able to figure this out successfully. My goal is to align the text elements next to the image just like in the example picture below. Initially, I achieved this using absolute positioning. absolute positioning Howe ...

Update a single javascript variable on every rotation of the Bootstrap carousel

Within my website, I have implemented a popin/modal feature using Hubspot Messenger which includes a Bootstrap 3 carousel. Each slide of the carousel displays a different "social embed" such as Facebook or Twitter, and I am looking to adjust the width of t ...

Ensure that the footer remains at the bottom of the page without being fixed to the bottom

I am currently working on configuring the footer placement on pages of my website that contain the main body content class ".interior-health-main". My goal is to have a sticky footer positioned at the very bottom of these pages in order to eliminate any wh ...

IE8 not displaying background-image in Zen Subtheme of Drupal 7

I've been struggling to get my website to display properly across all browsers. Everything looks great except for IE8 and below. I'm not sure if it's a problem with Drupal, Zen, IE, or CSS (although the CSS code seems correct). Here is the C ...

Combining JS Tree and Datatables for Enhanced Functionality

I am facing a challenge on my webpage where I have two columns. The left column consists of a checkbox jstree, while the right column contains a table using datatables. Both the table rows and tree are loaded at the start. My goal is to display a row when ...

Retrieving data from JavaScript global variables within an HTML document using PhantomJS

Recently, I encountered an interesting piece of HTML code that sparked my curiosity: <html> <body> <script> var foo = { bar: [] }; </script> </body> </html> This led me to wonder how I c ...

How can I accurately show the server time and timezone in JS/jQuery regardless of the user's location?

Apologies for bringing up another time and timezone question related to web development. Despite numerous resources available, I am still struggling to grasp the concept of converting time between PHP and JavaScript. Here is my scenario: I aim to retrieve ...

Alignment of Card Element at Bottom in Bootstrap 5

Hey there! I'm new to Bootstrap and I'm facing an issue where I want to position a button element at the bottom of a card, even when the body text is minimal. However, no matter what I try, the button does not end up in the bottom right corner as ...

What is the best way to align the logo image to the left side of the Material UI app bar without any gaps?

Currently, I am working on a material UI app bar to serve as my navigation bar. The issue I am encountering involves the logo image on the left side of the page having excessive spacing from the edge, as shown in the image below. I've tried adjusting ...

JavaScript encountered a ReferenceError: 'a' has not been declared

One interesting feature of my slider is that it uses links like <a id="foo" class="oslide">Chineese Food</a> to navigate through the slides. To make this navigation function properly, I had to include a.href = "#"; in the link's click even ...

Trouble with retrieving data from localStorage

On my webpage, I have set up multiple input fields where users can enter data. When they click a button, the data from these inputs is stored inside <span>...</span> elements (the intention being that the text remains visible in these <span& ...

Converting a PHP variable to JSON in an AJAX call

At the moment, my approach involves using a jQuery Ajax asynchronous function to repeatedly request a PHP page until a large number of spreadsheet rows are processed. I am uncertain if the way I set the variables to be passed to the requested page is corre ...

Tips for preventing vertical spaces between table header cells in material-UI

Is there a way to remove the vertical gaps between header cells in the MUI table? To see an example of the issue, check out this codesandbox link: https://codesandbox.io/s/mui-material-table-sticky-header-forked-euilo3?file=/tsconfig.json I have attempte ...