title: Call a function once page load after button click
body: <p>There is a scenario where I need a function like <code>xyz()</code> to be called once a button on page is clicked and page is loaded using javascript/jquery.
  I can't call <code>xyz()</code> directly on <code>&lt;Body onload="xyz()"&gt;</code> or inside <code>document.ready()</code> or  <code>$(window).on('load', function ())</code>.
  I need the function to be called once a button is clicked and page has loaded completely. 
  Below is working code on page load but not my requirement</p>
  
  <pre><code>&lt;body onload="xyz();"&gt;
      &lt;form id="form1" runat="server"&gt;            
          &lt;div id="vizContainer" style="width: 800px; height: 700px;"&gt;
          &lt;/div&gt;
      &lt;/form&gt;
  &lt;/body&gt;
  </code></pre>
  
  <p>Now below is my required code on button click and it is not working </p>
  
  <pre><code>&lt;body&gt;
          &lt;form id="form1" runat="server"&gt;
              &lt;asp:Button ID="Button1" runat="server" Text="Button" OnClientClick="functiongetdata()" /&gt;       
              &lt;div id="vizContainer" style="width: 800px; height: 700px;"&gt;
              &lt;/div&gt;
          &lt;/form&gt;
      &lt;/body&gt;
   &lt;script type="text/javascript"&gt;
          function functiongetdata() {
              xyz();
          }
      &lt;/script&gt;
  </code></pre>