<script type="text/javascript">
$(document).ready(function() {
alert("Hello jQuery.");
});
</script>
This works the first time I request /Home/Index
, but if I navigate to eg /Account/Login
then back to /Home/Index
it doesn't work. Doing the same thing using a webforms project works every time. What am I missing? Thanks.
Thanks for the replies. The answer, and a question: The relative reference to the .js files was OK for http: //localhost:12345/
but not http: //localhost:12345/Home/Index
- effectively they're the same resource, but not internally for mvc, despite the fact the mvc "paths" are logical not physical - so why does mvc make .js references relative to a logical path?