title: Call a function inside $('document').ready
body: <p>I have a function defined inside a <code>$('document').ready</code>.</p>
  
  <pre><code>$('document').ready(function() {
    function visit(url) {
      $.ajax({
        url: url,
        container: '#maincontainer',
        success: function(data) {
          init();
        }
      });
    }
  
    function init() {
      ...
    }
  )};
  </code></pre>
  
  <p>But when I call <code>init()</code> in Chrome Console I get : <code>ReferenceError: init is not defined</code>.</p>
  
  <p><strong>Update:</strong> Thank you all for your help. I did<code>window.init = init;</code> and it works perfectly.</p>