I am just trying to test jquery in one of my spring MVC project. I have added jquery-1.6.4.min.js file into WebContent/js/ folder. I am using jquery-1.6.4.min.js
Below is the code for my .jsp file. I don't understand where I am wrong. Is there anything else which I am not doing. I even have added the above .js file from windows->preferences-> javascript->include path->User Liberary
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Spring 3, MVC Examples</title>
<script type="text/javascript" src="/js/jquery-1.6.4.min.js"></script>
</head>
<body>
<script type="text/javascript">
$(document).ready(function(){
$("#msgid").html("Hello ");
});
</script>
<div id="msgid">
</div>
Thanks in ad开发者_开发知识库vance
I suspect your path is incorrect, relative and absolute path.
Can you change your source to http://ajax.googleapis.com/ajax/libs/jquery/1.5.2/jquery.min.js to isolate this.
Chin's suggestion to switch source to the online source is good: http://ajax.googleapis.com/ajax/libs/jquery/1.6.4/jquery.min.js
To troubleshoot your current version - if you create a war from your project, is your /js directory in the right place? If the path is wrong, then the jquery definitely won't load. You can use FireBug to see if there are any JS errors as well.
精彩评论