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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T13:14:35+00:00 2026-06-03T13:14:35+00:00

I have a .click() event on an element. After it’s closed, this mob has

  • 0

I have a .click() event on an element. After it’s closed, this mob has a transition that happens and an AJAX call that goes through. That’s all that happens.

What I need is a callback to put inside the .click() function to execute when both of those things are done, even if transitions aren’t supported. Here’s a timeline:

jQuery needs to wait for the ajax call and the transition, then execute the callback after the ajax call has completed AND the transition has either finished or not happened at all.

How can I do this? Thanks!

NOTE: I’m using $.ajax() for the ajax call and a normal CSS3 transition on the element in question. I can detect transitionEnd with javascript event binding, I have a variable setup for that called transitionEnd and another variable that detects if the browser support transitions call supportsTrans.

  • 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-03T13:14:37+00:00Added an answer on June 3, 2026 at 1:14 pm

    Have a flag for each event, initially false. Hook the two events in question (transitionEnd and the ajax success, it sounds like). Each event sets its flag and calls a function. That function checks the flags: If both are set, it does something.

    Here’s an example using animate rather than a CSS transition, just to keep things simple: Live example | source

    jQuery(function($) {
    
      $("#theButton").click(function() {
        this.style.display = "none";
        $("#box, #content").show();
        doTheStuff();
      });
    
      function doTheStuff() {
        var ajaxDone = false,
            ajaxFailed = false,
            animationDone = false;
    
        display("Triggering ajax and animation");
    
        $.ajax({
          url: "http://jsbin.com/ibebiv",
          method: "GET",
          success: function(data) {
            $("#content").append(data);
            display("ajax done");
            ajaxDone = true;
            checkDone();
          },
          error: function() {
            ajaxFailed = true;
            checkDone();
          }
        });
    
        $("#box").animate({
          left: "+200px"
        }, function() {
          display("animation done");
          animationDone  = true;
          checkDone();
        });
    
        function checkDone() {
          if ((ajaxDone || ajaxFailed) && animationFlag) {
            display("<strong>All done</strong>");
          }
        }
      }
    
      function display(msg) {
        $("<p>").html(msg).appendTo("#content");
      }
    });
    

    Note the error handling, in case the ajax call fails.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following click event $(.element).click(function() { var idNum = $(this).getID; $('#new-'+idNum).fadeIn(); });
I have a menu click event that looks something like this.... Public Sub ToolbarManager_ToolClick(sender
I have this js code to add (clone) and delete an element. $('#btnAdd1').click(function (event)
I have a mouseDown event and a click event on the same element. When
I have a Raphael text element with both a mouseup and click event handler.
i have a click event for $('#blah div'). div has text inside of it
On page1.php I have a click event that causes the user to be redirected
It seems that the WPF Rectangle shape does not have the Click event defined.
I have a button click event that takes information from controls and enters it
If I have a jQuery .click() event firing for both body and a div,

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.