title: Laravel site not using Ajax in external javascript file
body: <p>I am trying to have my site use Ajax from another file but it never works unless the code is actually in the view. </p>
  
  <p>The site successfully calls my other Javascript file but does not seem to recognize the one with Ajax in it.</p>
  
  <p>The following is in my external Javascript file with Ajax in it (ajax.js):</p>
  
  <pre><code>$(document).ready(function(){
  
      $("#idForm").submit(function(e) {
          $.ajax({
              type: "POST",
              url: "{{ url('/auth/login') }}",
              data: $("#idForm").serialize(),
              success: function(data)
              {
                location.reload(); 
              }
          });
  
          e.preventDefault(); // avoid to execute the actual submit of the form.
      });
  
  });
  </code></pre>
  
  <p>And the following is in my master layout file that successfully uses the form.js file but not ajax.js .</p>
  
  <pre><code>&lt;html&gt;
  &lt;body&gt;
  
  &lt;!--Other Stuff--&gt;
  
  &lt;script src="http://cdnjs.cloudflare.com/ajax/libs/jquery/2.0.3/jquery.min.js"&gt;&lt;/script&gt;
  &lt;script type="text/javascript" src="http://localhost/sitename/public/js/forms.js"&gt;&lt;/script&gt;
  &lt;script type="text/javascript" src="http://localhost/sitename/public/js/ajax.js"&gt;&lt;/script&gt;
  
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>Any ideas?</p>