Issues with progress loading bars are preventing them from functioning properly on both Chrome and Internet

When I call an ajax method, I have a custom loading bar that works perfectly in Firefox.

This is how my code looks: HTML:

<div id="loading_dim" >
     <div></div>
</div>

CSS :

 #loading_dim {
      position: fixed;
      left:0;
      right:0;
      top:0;
      bottom:0;
      background: url('/../img/glass.png');
      display: none; 
 }
 #loading_dim > div {
      position: fixed;
      left:0;
      right:0;
      top:0;
      bottom:0;
      background: url('/../img/processing.gif') center center no-repeat;
 }

JAVASCRIPT :

 $('#loading_dim').show();

Ajax code ......

 $('#loading_dim').hide();

I have also tried other methods like using jQuery .css('display','block') and pure Javascript

document.getelementbyid(elementID).style.display='block';
They all work in Firefox but not in Chrome or IE.

Answer №1

<style>
#loading_dim > div {
    position: fixed;
    display: none; 
}
</style>
<div id="loading_dim" >
     <div>Loading Content</div>
</div>

<br/><br/><br/><br/><br/>
<div>
<input type=button onclick="revealContent()" value="Reveal">
<input type=button onclick="hideContent()" value="Hide">
</div>
<script src="jquery-1.11.1.min.js"></script>
<script>
function revealContent(){
    $("#loading_dim").find("div").show("slow");
}

function hideContent(){
    $("#loading_dim").find("div").hide("slow");
}
</script>

Answer №2

Just include the line $('#loading_dim').hide(); within the success method. If you are unable to modify the ajax call itself, do this:

function(){
 $.ajax({
 url: 'your modified url',
 type: 'POST',
 data: {},
 async: false,
 success: function() {
   $('#loading_dim').hide();
 }
});

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

Implementing a filter on retrieved data from an API in a React application

I'm retrieving information from this Api After fetching the data, I need to check if the gender is Male in order to display a Male Icon. How can I perform this check on the Api data and return some HTML data like an img tag or something to show the i ...

Apache Tomcat is informing you that the resource you are trying to access is currently unavailable. This error message occurs when attempting to access a resource that

This is my first time asking a question here (please be kind :)). I've searched high and low for the solution to my issue (and maybe lost my mind a little along the way). Currently, I am working with Tomcat 7 and the latest Eclipse IDE for Java EE de ...

Assistance needed for Internet Explorer

When I designed a webpage in Firefox, everything looked great. However, when I opened it in Internet Explorer and resized the window to less than maximum size, half of the main div disappeared under the footer. If you want to see the issue for yourself, v ...

Troubles arise with IE8 when using Position: fixed styling

Here is the CSS code I am using: background-color: White; border: 2px solid black; padding: 10px; position: fixed; right: 5px; top: 0; width: 250px; While this code works well in Chrome, Firefox, and Safari, I am facing issues with IE8. The position of t ...

Is it possible to validate if the file format matches the file name extension using Python or Javascript?

My uploader includes file format validation to only allow certain video formats to be uploaded. However, users could potentially bypass this validation by simply changing the original file name extension (e.g. renaming file.pdf to file.mov and uploading)! ...

Issues with saving data in a database using Laravel with Ajax

I have encountered a new issue where I was previously able to successfully store data in the database, but now I am facing difficulties. I have been passing some fields through ajax and everything was functioning well until recently. Below is my controlle ...

Learn how to update a fixed value by adding the content entered into the Input textfield using Material-UI

I made a field using the Input component from material-ui: <Input placeholder="0.00" value={rate} onChange={event => { this.setState({ `obj.rate`, event.target.value }); }} /> Whenever I input a rate into this field, ...

Creating a custom bookmarklet that utilizes document.body.search()

I'm currently working on a bookmarklet that scans the body of a webpage for a specific text string and triggers a script when it finds a match. My code snippet document.body.search(); is resulting in an error message. [Error] TypeError: undefined is ...

Check if the page has been loaded using Jquery

Can anyone share a helpful strategy for initiating a function in JavaScript that only begins once the entire page has finished loading? ...

Determine total and showcase it as the range slider is adjusted

Seeking to calculate and present the result of three range sliders. The equation I aim to showcase is: KM driven per year * Avg KM/100L / Price of fuel I have managed to display each slider's individual values, but I am uncertain about how to show t ...

Displaying Keystonejs list items on every page

Is there a more effective method to efficiently load the content of a Keystone's list on every page, rather than calling it individually in each view? Could this be achieved through middleware.js? The objective is to create a dropdown for the navigat ...

Explain and suggest the necessary parameters for a function

Is there a way to clearly describe the parameters required by my function and make them visible when I am typing my code? For instance, if we consider the ExpressJS render function below, it effectively shows what the callback expects and will return. In ...

Uploading files to a server using Node.js without the need for additional frameworks

I am currently working on a basic file uploading website and I am utilizing the XmlHTTPRequest to handle file uploads. So far, I have dealt with this process only in the context of a server that was already set up for file uploading. Now, however, I need t ...

Tips for altering the color of a line by manipulating the div ID

I recently implemented multiple charts on a single page following the documentation provided by Chartist: (source: ) <div class="ct-chart ct-golden-section" id="chart1"></div> <div class="ct-chart ct-golden-section" id="chart2"></div& ...

Modify the color of the sidebar menu items in R Shiny

I am trying to find out the tag name that can be used to change the color of the blue line in the menuItem image on Shiny Dashboard. I have successfully changed the background color of the sidebar menu item using the following code: .skin-blue .main-sideb ...

Using accent marks in AJAX to retrieve information from a database

I'm currently working on compiling a list that can be found at the following link: Within the php file, I have implemented meta tags to handle accents. However, when using ajax to display search results, entering accents such as ö,ü,ő etc in the s ...

Optimizing the appearance of an unordered horizontal list in the most effective manner

When attempting to make lists horizontal and hide default bullets, is it necessary to apply {display:inline} and {float:left} to both the <li> tags or would just one of these properties suffice? <ul> <li><a href="#">First item< ...

Refreshing the <object> element with AngularJS

I'm currently working on a web project that involves users uploading PDF files. I've encountered an issue where, after a user deletes a previously uploaded file and tries to upload a new one, the preview still shows the deleted file. The preview ...

Deleting a string by utilizing the Ternary operator in JavaScript

How do I remove the [object Object] from my output shown in the console? I'm looking to print the output without the [Object Object]. Is it possible to achieve this using a ternary operation? data:[object Object] text:Data is supplied by Government ...

use the fetch api to send a url variable

I'm struggling to pass a URL variable through the API fetch and I can't seem to retrieve any results. As a newcomer to Javascript, any help is greatly appreciated. //Get IP address fetch('https://extreme-ip-lookup.com/json/') .then(( ...