title: Uncaught SyntaxError: Unexpected token /
body: <p>I just moved a bunch of javascript from being inline, into a separate js file, to take advantage of caching files etc.</p>
  
  <p>When I load my page that consumes the js file, I get the following error message: </p>
  
  <p>Uncaught SyntaxError: Unexpected token / </p>
  
  <p>The line number it's complaining about looks like this: </p>
  
  <pre><code>url:'&lt;?php echo site_url('switches/showknownvins/'.$Name.'/'.$model.'/'.$fn);?&gt;',
  </code></pre>
  
  <p>It's a part of an ajax call.  The lines of code above and below look like this: </p>
  
  <pre><code>    $.ajax({
      url:'&lt;?php echo site_url('switches/showknownvins/'.$Name.'/'.$model.'/'.$fn);?&gt;',
      type:'POST',
      dataType:'json',
      success: function(returnDataFromController) {
  </code></pre>
  
  <p>I have a total of 203 lines of js code, starting with :</p>
  
  <pre><code>$(document).ready(function(){    
  </code></pre>
  
  <p>and ending with </p>
  
  <pre><code> });
  </code></pre>
  
  <p>When I paste the code back into the PHP file, it works fine.
  I can't see where my error is. </p>
  
  <p>Any suggestions? </p>
  
  <p>Thanks</p>
  
  <p><strong>EDIT 1</strong></p>
  
  <p>If I rename my .js file to .php and include that, what's the impact?  Will the web server still cache it ?  That's really what I'm after. I'm trying to improve the speed of my web application because I have a lot of mobile users. </p>