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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T13:55:34+00:00 2026-06-10T13:55:34+00:00

Code below works but what doesn’t work properly is delaying process because I don’t

  • 0

Code below works but what doesn’t work properly is delaying process because I don’t know how long it is going to take for process.php to response. It always differ. No certain time.

Code below works (apart from faulty delay) like this:

  1. When I click run icon, run icon should disappear and loader icon should appear slowly.
  2. After response coming from process.php, loader icon should disappear slowly and success/fail icon appear slowly. Straight after next (div) should appear slowly if successful.

Thanks

$(document).ready(function()
{
   $("#run").click(function(event)
   {
      $('#run').hide();
      $('#loader').fadeIn(1000).delay(1000);

      $.ajax(
      {
         type       : 'POST',
         url        : 'process.php',
         data       : 'user=jolly',
         dataType   : 'json',
         success    : function(response)
         {
            if(response.status == 'success')
            {
               $('#loader').delay(1000).fadeOut();
               $('#success').delay(4000).fadeIn(1000);
               $('#next').delay(4500).fadeIn(1000);
            }
            else
            {
               $('#loader').delay(1000).fadeOut();
               $('#fail').delay(4000).fadeIn(1000);
               $('#next').delay(4500).fadeIn(1000);
            }
         }
      });
   });
});


<div id="first">
   <img id="run" src="run.png" />
   <img id="loader" src="loader.png" style="display:none;" />
   <img id="success" src="success.png" style="display:none;" />
   <img id="fail" src="fail.png" style="display:none;" />
</div>
<div id="next" style="display:none;">
   ....
   ....
</div>
  • 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-10T13:55:36+00:00Added an answer on June 10, 2026 at 1:55 pm

    Does it accord with your question?

    $('#run').hide();
    $('#loader').fadeIn(1000);
    
    $.ajax({
      type: 'POST',
      url: 'process.php',
      data: 'user=jolly',
      dataType: 'json',
      success: function (response) {
        $('#loader').stop(true).fadeOut(function () {
          if (response.status == 'success') {
            $('#success').fadeIn(1000, function () {
              $('#next').fadeIn(1000);
            });
          } else {
            $('#fail').fadeIn(1000);
          }
        });
      }
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

The below code works fine in Chrome, but doesn't work correctly in Firefox. In
The below code works well on localhost using XAMPP. But it doesn't work on
The example code below works as as a server process. But when I add
I want to change JDialog icon. Code below works for *.jpg files, but doesn't
I use below code for accelerometer and it works on ipod 3g but doesn't
Code below works fine in FF, CH etc. but doesn't get centred in IE.
I have to code below - works great in IE and Opera, but does
The code below does not work but meant to illustrate what I want to
The code below works well but grabs only the UIView which is VISIBLE on
the code below works fine but it takes an absolute age to run. How

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.