title: can we call a function outside the document.ready in jquery
body: <p>I have tried doing various things but no luck. My idea is to call a function in between the php code like this  sample();  if this gets success. <strong>Can any one help me.</strong></p>
  
  <pre><code>&lt;p id="test"&gt;&lt;/p&gt;
  
  &lt;script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"&gt;&lt;/script&gt;
  &lt;script&gt;
    $(document).ready(function() {
      jquery_test = function() {
        $('#test').text('jquery test');
      }
      jquery_test(); // this function works
    });
  
    try {
      jquery_test(); // this function doesn't
    } catch(e){
      console.log(e.message); // throws "jquery_test is not defined"
    }
  &lt;/script&gt;
  </code></pre>