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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T01:32:04+00:00 2026-06-05T01:32:04+00:00

I have a jQuery $.ajax call which works fine in all major browsers. Additionally

  • 0

I have a jQuery $.ajax call which works fine in all major browsers.

Additionally I make use of .ajaxStart and .ajaxStop functions to make
an invisible div on my page that says “loading…” , visible.

The problem is that while both ,ajaxStart and .ajaxStop , events fire
without any problems (I check it from the console.log()) , the .show event
of jQuery in ajaxStart is completelly ignored in Google Chrome.

Here is the code :

$("#loadMsg").ajaxStart(function(){
   console.log('ajaxstart');
   // the next command is ignored ONLY in Google Chrome
   $(this).show(0);
}); 

$.ajax({
  url:"xxx.php",
  type:"POST",
  data:"id="+id,
  async:false,
  success:function(data)
  {
     console.log(data); 
  }
});  

$("#loadMsg").ajaxStop(function(){
  console.log('ajaxfinish');
  $(this).hide(0);
});

I already tried:

$("#loadMsg").show(0);  
$("#loadMsg").fadeIn();  
$("#loadMsg").css("display","block");  
$("#loadMsg").css("display","inline");  

etc.

Any suggestions would be really appreciated.

  • 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-05T01:32:05+00:00Added an answer on June 5, 2026 at 1:32 am

    After 2 days of struggling I finally found the solution.
    The whole code I posted above was inside a function,which returned the result of xxx.php via the success property to the main code.

    The problem was that when I used the async:true option ,the function returned immediately the return value without waiting for ajax to complete the request.
    So the returned value had always a value of “undefined” and not the proper outcome of xxx.php.

    The solution of running ajax asynchronous and proceeding with the rest of the code ONLY when the ajax request is completed , is to place the whole code inside success parameter.

    I’ll try to make it clear with the following example:

    Code that didn’t work :

    function foo()
    {
    
     if call_ajax_request()=="true"
      {
        //execute code A
        // never had the chance to be executed because call_ajax_request() 
        // was always undefined
      }
    
    }
    
    
    
    function call_ajax_request()
    {
    
      var return_value;
    
      $.ajax({
      url:"xxx.php",
      type:"POST",
      data:"z="+y,
      success:function(data)
        {
               return_value = data;
            }
        }); 
    
        //return_value was always "undefined" because the flow didn't wait
       // for ajax to complete (async mode)
       return return_value;
    }
    

    code that finally did the job :

    function foo()
    {
    
      $.ajax({
       url:"xxx.php",
       type:"POST",
       data:"z="+y,
       success:function(data)
         {
                return_value = data;
    
                //here, the following code won't be executed 
                //as long as ajax hasn't been completed.
    
                if (return_value=="true")
                {
                   //execute code A
                }
             }
       }); 
    
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

On my main page I have this jquery code which does an ajax call
I'm having some issues with a jQuery AJAX call. My code works fine when
I have a dropdown list which is populated via a jquery ajax call when
I have this little piece of jQuery/jqModal code which works fine. However, I am
I have a jQuery ajax call that returns html of a table. Now I
I have a jQuery AJAX call that I will need to do multiple times
I have a jQuery AJAX call with type:'GET' like this: $.ajax({type:'GET',url:'/createUser',data:userId=12345&userName=test, success:function(data){ alert('successful'); }
A situation I ran across this week: we have a jQuery Ajax call that
I have a jquery json ajax call and inside my success function I have
I have a web service that returns this string via the jQuery $.ajax() call

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.