I am working with session timeout in javascript.
I use this code for the timeout in my .js file:
var wintimeout;
function SetWinTimeout() {
intimeout = window.setTimeout("redirect();",g_secTimeout); //after 5 secs i.e. 5 * 1000
}
//$('body').click(function() {
jQuery('body').click(function() {
window.clearTimeout(wintimeout); //when user clicks remove timeout and reset it
SetWinTimeout();
});
});
In my .php file I included the jquery source:
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.2.6/jquery.min.js"></script>
<!--script type="text/javascript" src="../js/jquery.alerts-1.1/jquery.js"></script-->
I tried both of this..
But when I run it it still gives me the ‘$ is undefined’ or ‘jQuery is undefined’ error for IE and FF.
Aside from jquery I am using the prototype library. In my other pages, it is working
which is also using jquery and protoype. But for these other pages it keeps giving me this error.
It gets really frustrating ;(
Can somebody help!
If this should matter:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtm11/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
Strip a copy of your page down to the bare minimum; nothing in the
<body>, just<script src="path/to/jquery.js">in the plus the following inside its own<script></script>tags:If it still gives the same error, then it must be the path to the jQuery file; correct the path.
Once that’s working, build the page up again by adding HTML, CSS and other javascript back in.