I have tried running a simple html file which includes a jquery.js file with a jquery click() alert, when I manually open the html file in a browser the jquery/javascript works fine.
However if I host this html (or any aspx) file in IIS 7.5 everything else works including CSS and html however the jquery javascript functions from the .js do not work. I have a clean install of ASP.NET, IIS 7.5 and Visual Studio 2010 but no luck.
I looked in the applicationHost.config file and .js files seem to be there and enabled. I am running the application pool for the IIS website in Integrated mode .net 4.0. The weird thing is that Visual Studios built in Cassini web dev server also has the same problem and won't server .js files. This is what is in my web.config:
<?xml version=1.0 encoding=UTF-8?>
<configuration>
<system.web>
<compilation debug=true targetFramework=4.0 />
</system.web>
<system.webServer>
<urlCompression doStaticCompression=true />
</system.webServer>
</configuration>
Any ideas? Here is the html, I've tried it with the google cdn jquery js too:
<html>
<head>
<script src=Scripts/jquery-1.7.1.min.js type=text/javascript></script>
<script type=text/javascript>
$(document).ready(function(){
$(p).click(function(){
$(this).hide();
});
});
</script>
</head>
<body>
<p>If you click on me, I will disappear.</p>
<p>Click me away!</p>
<p>Click me too!</p>
</body>
</html>