I declared javascript global variable in global.js file eg:
var glbValue;
and putting the value of global variable glbValue from first.html eg:
<script type="text/javascript" src="global.js"></script>
<script type="text/javascript">
function onBtnSubmit()
{
glbValue=123;
}
</script>
and accessing the global variable glbValue from second.html eg:
<script type="text/javascript" src="global.js"></script>
<script type="text/javascript">
function onBtnClick()
{
alert(glbValue);
}
</script>
it gives me output undefined inplace of 123, why ?
gbValuewith value123when it loadssecond.html. are you loadingfirst.htmland then loadingsecond.htmlwithinfirst.html?cookiesin case you wish to share a variable between pages