title: Uncaught ReferenceError:foobar is not defined (anonymous function)
body: <p>I have this js file serving from some domain say <code>foobar.com</code> </p>
  
  <pre><code>at http://foobar.com/static/js/main.js:
  
  $(document).ready(function() {
          function foobar(bar){
              $.ajax({
                      url: "/site/foo/",
                  data: {'foo':bar},
                      dataType: "jsonp",
                      crossdomain: !0,
                      success: function (data) {
                  alert(data);
                      },
                      error: function () {
                      }
                  })
          }   
      });
  </code></pre>
  
  <p>On <code>barfoo.com</code> on some url, I have something like this:</p>
  
  <pre><code>&lt;script src='http://foobar.com/static/js/main.js' type='text/javascript'&gt;&lt;/script&gt;
  &lt;script type='text/javascript'&gt;foobar('123456')&lt;/script&gt;
  </code></pre>
  
  <p>When I hit that url : it says</p>
  
  <pre><code>Uncaught ReferenceError:foobar is not defined (anonymous function)
  </code></pre>
  
  <p>How to access function from other domains?</p>