Ayush
Ayush

Reputation: 115

Javascript Firebug error

I have a JavaScript code coupon.js defined as follows -

jQuery(document).ready(function(){
jQuery('.appnitro').submit( function() {
$.ajax({
 url : $(this).attr('action'),
 type : $(this).attr('method'),
 dataType: 'json',
 data : $(this).serialize(),
 success : function( data ) {
 for(var id in data) {
 jQuery('#' + id).html( data[id] );
 }
 }
 });

Now Firebug throws following error -

jQuery is not defined
[Break on this error] jQuery(document).ready(function(){\n

Can someone explain the error and ways to remove it? Thanks in advance.

Upvotes: 0

Views: 1636

Answers (3)

Ryan Ternier
Ryan Ternier

Reputation: 8804

How are you referencing your JQuery JS script files? Either they're pointing to a location that doesn't exist, they don't exist, or you used a self-closing script tag ()

Upvotes: 0

Darin Dimitrov
Darin Dimitrov

Reputation: 1038810

Put this into the head section of your page before any other script:

<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>

Upvotes: 6

&#181;Bio
&#181;Bio

Reputation: 10748

It looks like your page doesn't include jquery

<script type="text/javascript"
   src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js">
</script>

Upvotes: 3

Related Questions