I am using Jquery for getting a json object from a solr server. When I run my html file with Tomcat it is runns fine but when I embed it with my project which is running on weblogic it gets this error: (debugging done through firebug)
$ is not defined
$(document).ready(function(){
Why do I get this error when I embed it in my project?
This is the contents of my <head> tag, It is how I include jquery.js:
<head>
<title>Search Result </title>
<style>
img{ height: 150px; float: left; border: 3;}
div{font-size:10pt; margin-right:150px;
margin-left:150px; }
</style>
<script type="text/javascript" src="jquery-1.6.1.js"></script>
<script type="text/javascript">
$(document).ready(function(){ //Error happens here, $ is not defined.
});
</script>
</head>
Did you load jQuery in
headsection? Did you load it correctly?This code assumes
jquery.jsis inscriptsdirectory. (You can change file name if you like)You can also use jQuery as hosted by Google:
As per your comment:
Apparently, your web server is not configured to return
jQuery-1.6.1.json requesting/webProject/jquery-1.6.1.js. There may be numerous reasons for this, such as wrong file name, folder name, routing settings, etc. You need to create another question and describe your404in greater details (such as local file name, operation system, webserver name and settings).Again, you can use jQuery as provided by Google (see above), however you still might want to find out why some local files don’t get served on request.