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 8555447
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T15:07:29+00:00 2026-06-11T15:07:29+00:00

I am using jquery ajax to load a separate page into a modal window

  • 0

I am using jquery ajax to load a separate page into a modal window when a link is clicked. While the modal content is loading, I have a loading image that displays. The loading image is in a div on the page and is shown for any ajax loading on the page. This all works correctly, but I can’t seem to get the image to hide after the ajax call is successful.

Here is the jquery I am using:

$('#loadingImage').ajaxStart(function(){
    $(this).show();
});
$('#loadingImage').ajaxSuccess(function(){ //also tried ajaxStop
    $(this).hide();
});

function loadMap(){         
$('#whereweare-map').click(function(){
    $('#lightBox').removeClass().addClass('reveal-modal expand');
    $.ajax({
        url: '/Map#mapLoad',
        success: function(data){
            $('#lightBox').reveal();
            $('#lightBoxContent').html(data);         
        }
    });
       return false;
        });
    }
loadMap();

HTML:

<div id="imageLoading"></div>
<a href="#" id="whereweare-map">Where We Are</a>
<div class="reveal-modal" id="lightBox">
    <div id="lightBoxContent"><!-- Load Content Here --></div>
    <a class="close-reveal-modal">&#215;</a>
</div>

And the CSS:

#loadingImage {
display:none; 
height:84px; 
width:84px; 
position:fixed; 
top:50%; 
left:50%; 
z-index: 1;
background: url('preloader.gif') no-repeat center center;
background-color: #000; 
background-color: rgba(0, 0, 0, 0.7);
-moz-border-radius:45px;
-webkit-border-radius:45px;
border-radius:45px;
}

Thanks for the help.

  • 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-11T15:07:31+00:00Added an answer on June 11, 2026 at 3:07 pm

    ajaxStart and ajaxStop are global functions. SO they respond to any ajax request on the page. Instead of showing/hiding the in these functions why don’t you do the same in the beforeSend and complete functions.. this makes sure the image is shown/hidden at the right times

    function loadMap() {
        $('#whereweare-map').click(function () {
            var $loader = $('#loadingImage');
            $('#lightBox').removeClass().addClass('reveal-modal expand');
            $.ajax({
                url: '/Map#mapLoad',
                success: function (data) {
                    $('#lightBox').reveal();
                    $('#lightBoxContent').html(data);
                },
                beforeSend : function(){
                   $loader.show();
                },
                complete : function(){
                   $loader.hide();
                }
            });
            return false;
        });
    }
    loadMap(); 
    

    Also instead of ajaxSuccess why don’t you try the ajaxComplete function to hide your div..

    $('#loadingImage').ajaxComplete(function(){ //also tried ajaxStop
        $(this).hide();
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am using jquery ajax to load content from one page into a div
I'm using jQuery ajax to load content into my web page. When a user
So I have a system using jQuery AJAX to load the content dynamically. I
I am using the jquery ajax api so load in some content, the code
I am using jquery-ui tabs and ajax to load the content of the tabs.
I am using jQuery to load a page by AJAX using $.ajax (suppose test.html).
I'm using jQuery UI Tabs to load some content via Ajax when the user
I'm loading part of my webpage using AJAX, in particular jQuery.load() . With this
What is the best way to load content into my infowindow using ajax? Right
I'd like to inject jQuery into a page using the Google AJAX Libraries API,

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.