1

The page loads up fine, but console shows a 404 not found error for JavaScript files. I have verified that the code contains the correct JavaScript file name. Any ideas?

The JavaScript file is loaded like this of course by HTML:

<script type="text/javascript" src="jquery.js"></script>

Environment: Windows 7; FastCGI; PHP. The instructions for installation came from this site:

http://www.microsoft.com/web/platform/phponwindows.aspx

I made a basic html file that looks like this:

<html>

<head></head>
<body>

hello again.
<div id="11">
hello
</div>
<script type="text/javascript" src="http://localhost/analyst_scrape/jquery.js"></script>

<script type="text/javascript">
$("#11").click(fucntion(){

    alert("good bye");
});

</script>
</body>
</html>

The html file gives me a blank page. However when i change the file ext to .php, I get the following error in console:

GET http://localhost/analyst_scrape/jquery.js 404 (Not Found) test.php:10
Uncaught ReferenceError: $ is not defined 

1 Answers1

1

Looks like you are simply specifying the wrong path. You have not given any information about what you are actually doing so this is just speculation. You mention cgi/phpso I assume you are serving a page that generates the html by running a php script in the cgi/php directory under your page's root.

If that is the case, if the root of your page is foo, then the page you are viewing is in foo/cgi/php/ and your javascript file is probably in foo itself. Try specifying the correct path:

<script type="text/javascript" src="../../jquery.js"></script>

Or even the full URL:

<script type="text/javascript" src="http://www.foo.com/jquery.js"></script>
terdon
  • 54,564