1

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

2 Answers 2

1

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.

Sign up to request clarification or add additional context in comments.

Comments

0

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.

2 Comments

Thanks Chin and Thanks JW01.. yes its working with if I give ajax.googleapis.com/ajax/libs/jquery/1.6.4/jquery.min.js and JW01 you right firebug is giving error that it can't load .js file. But still I can't understand why its not loading .js file even I have copied the full path from file prperties..Anyway thanks for your prompt help
@Harry, take a look at the structure of your war file - you'll want to see where your js directory is located relative to your jsp file.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.