Ajax Posting Is Shown As Red Color In Firebug
Solution 1:
Add var $ = jQuery
top of your script like..
<scripttype='text/javascript'>var $ = jQuery;
// your functions here...</script>
or
$(document).ready(function() {
// your functions here...
});
Recommend :
Add your script before closing <body>
tag like...
<!DOCTYPE HTML><html><head><metahttp-equiv="Content-Type"content="text/html; charset=UTF-8" /><title>Your Website</title></head><body><header></header><section></section><aside></aside><footer></footer><scriptsrc="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script><script>window.jQuery || document.write('your_local_here/jquery.js"><\/script>')</script><scriptsrc="custom.js"></script><script>// or here</script></body></html>
Solution 2:
If I had to guess, I'd say that this file is in a subfolder.
Make sure you include your scripts using paths relative to the domain root, not to the current file:
<scriptsrc="/js/jquery.min.js"></script><scriptsrc="/js/scripts.js"></script>
This will ensure that your scripts can be found, no matter where you are on your site.
Solution 3:
You need to wrap your code into
$(function() {
// your code here...
});
This will make sure your code works as expected with all DOM elements you're accessing already available. As for jQuery itself, try replacing your local jQuery include with
<scripttype="text/javascript"src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
and see if that helps. If it does, your local file is not included properly - probably wrong folder/subfolder.
Solution 4:
Whenever you see a $ is not defined
means that jquery isnt being loaded. add this:
<scripttype="text/javascript"src="http://code.jquery.com/jquery-1.9.1.min.js"></script>
also remember that this path must be on top of all other jquery files or scripts.
Solution 5:
Please check your jquery file path Write your script inside "ready event"
$(document).ready(function(){
//Some javascript code
});
Post a Comment for "Ajax Posting Is Shown As Red Color In Firebug"