title: How to call an action after click() in Jquery?
body: <p>I want to load an image and some other actions after I click a certain DOM element, but I want to load them AFTER the clicking action finished.</p>
  
  <p>Here is a code example:</p>
  
  <pre><code> $("#message_link").click(function(){
     if (some_conditions...){
         $("#header").append("&lt;div&gt;&lt;img alt=\"Loader\"src=\"/images/ajax-loader.gif\"  /&gt;&lt;/div&gt;");
     }
   });
  </code></pre>
  
  <p>The problem is that the if condition executes before the click action have finished(Or at least that is my impression). I need that the If condition executes after the click action has finished. Can some one please tell me a solution?</p>
  
  <p>Thanks :)</p>