title: How to call a function when Modal has loaded?
body: <p>I have the function below. I want to call the function when the myModal has finished loading. This is what I have so far. </p>
  
  <pre><code>(function ($) {
  
  
      $.ajaxSetup({"error":function(XMLHttpRequest,textStatus, errorThrown) {
            alert(textStatus);
            alert(errorThrown);
            alert(XMLHttpRequest.responseText);
        }});
  
      function get_fun() {
  
           $.getJSON('/sms/fetch/', function(json) {
              alert('json: ' + json + ' ...');
          });
  
  
      };
  
  
  })(jQuery, window, document);
  </code></pre>
  
  <p>on page: <strong>How do I now call my function?</strong></p>
  
  <pre><code>&lt;script src="/js/smart.js"&gt;&lt;/script&gt;
  
  &lt;script&gt;
  $(document).ready(function() {
      $('#myModal').on('shown', function() {
  
  
        get_fun()
      })
  });
  &lt;/script&gt;
  </code></pre>
  
  <p><strong>I get the error: ReferenceError: get_fun is not defined</strong></p>