title: Execute a method whenever some method has finished executing completely
body: <p>I've a javascript method defined as follows:</p>
  
  <pre><code>updtCrtEdtPage = function() {PrimeFaces.ab({source:'j_id_ev',formId:'j_id_es',process:'typeNewLOB_in lobIdForEdit j_id_ev',update:'createLOBFullPagePanel',oncomplete:function(xhr,status,args){prepareForCrtEdtFullPage();},params:arguments[0]});}
  </code></pre>
  
  <p>I want to <strong>execute certain method (<em>afterComplete()</em>) whenever this method has finished executing</strong>. (This method actually initiates an ajax request &amp; appends the received HTML data on the DOM). So I want my <em>afterComplete()</em> method to be executed whenever ajax response has been  received.</p>
  
  <p>I cannot directly do like:</p>
  
  <pre><code>updtCrtEdtPage();
  afterComplete();
  </code></pre>
  
  <p>as this would call the afterComplete() soon after ajax request is initiated &amp; not completely finished executing yet.</p>
  
  <p>Is there any JS/ jQuery way I could do that ?</p>