title: Calling function from another javascript inside jquery
body: <p>I have a Javascript file named <code>loader.js</code> which contains a function called <code>initialize()</code>. I want to call this function via jQuery. This is my HTML file:</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;!DOCTYPE html&gt;
      &lt;html&gt;
          &lt;head&gt;
          &lt;script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"&gt;&lt;/script&gt;
          &lt;script src="loader.js" &gt;&lt;/script&gt;
        &lt;script type="text/javascript"&gt;
        jQuery(document).ready(function() {
        jQuery(document).on("click", ".link", function(e) {
              e.preventDefault();
        var a= $(this).text();
         window.initialize= function{
         };
        initialize(a);
        
         
         });
         });
        
           
       
       &lt;/script&gt;
          &lt;/head&gt;
          &lt;body &gt;
       &lt;h1&gt;welcome to my website &lt;/h1&gt;
       &lt;a href="#" class="link"&gt; link1 &lt;/a&gt;
       &lt;a href="#" class="link"&gt; link2 &lt;/a&gt;
          &lt;div id="main"&gt;
       
       &lt;/div&gt;
          &lt;/body&gt;
      &lt;/html&gt;</code></pre>
  </div>
  </div>
  </p>
  
  <p>This is loader.js:</p>
  
  <pre><code> function initialize(a) {
      $('#main').html= a;
           }
  </code></pre>
  
  <p>I do not  know what is wrong with this script, I have debug it jquery is working fine but funtion is not working correctly.<br>
  also I want that whenever the function is clicked again the div should be refreshed for example first it contain link1 but when link2 is clicked link1 should be removed inside the div how can i accomplish this task????</p>
  
  <p>thanks in advance</p>