Sunday, June 2, 2024
 Popular · Latest · Hot · Upcoming
53
rated 0 times [  58] [ 5]  / answers: 1 / hits: 24174  / 13 Years ago, thu, february 16, 2012, 12:00:00

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>

More From » jquery

 Answers
4

I reinstalled IIS and all was well, though that required a restart which maybe I hadnt done the first time around!


[#87415] Wednesday, February 15, 2012, 13 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
naya

Total Points: 60
Total Questions: 87
Total Answers: 87

Location: Guam
Member since Fri, Jun 18, 2021
3 Years ago
;