Harry
Harry

Reputation: 261

Jquery not working with spring MVC project

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 advance

Upvotes: 1

Views: 2540

Answers (2)

JW8
JW8

Reputation: 1506

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.

Upvotes: 0

HJW
HJW

Reputation: 23443

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.

Upvotes: 1

Related Questions