Search code examples
javascriptjqueryapache2webserverdocument-root

cant get jquery to work with php file


I have a linux webserver that has /var/www configured in the Apache2.conf file as the DocumentRoot. Next I have my jquery core file located at /var/www/js/jQuery_v1.4.2.js (a central location for all my websites to access.

The .php index file is located at /var/www/AOI/aoiparse.php, where the aoifunctions.js file is also located. My <head> tag looks as follows:

 <script type='text/javascript' scr='/js/jQuery_v1.4.2.js'></script>
 <script type='text/javascript' scr='aoifunctions.js'></script>

my aoifunctions.js file has the following in it in order to verify that the script link works:

  $(document).ready(function(){
     alert("hello");
  });

My problem is that I cannot get the alert() to work. I'm not getting an error message so I do not know where the problem is.


Solution

  • You can try <script type='text/javascript' src='../js/jQuery_v1.4.2.js'></script>

    (The attribute is src, not scr, plus your path was incorrect)