0

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.

3 Answers 3

6

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>
Sign up to request clarification or add additional context in comments.

1 Comment

It doesn't need to be in the <head>. Many JS Guru's are advocating putting these at the end of the Body to speed up the page load.
3

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>

Comments

0

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 ()

Comments

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.