I'm new to node.js. I have two html files and one shared common.js. In index1.html, when anchor button is clicked it calls changetest() function of common.js(which updates test variable). now i want to use the updated variable in index2.html. But index2.html picks the original value of test. (which may be because in new page index2.html reloads the common.js) please help what can be the good way of passing and receiving test value in index2.html.
Index1.html
<html>
<head>
<script type="text/javascript" src="common.js"></script>
</head>
<body>
<h1>Sample Page</h1>
<a href="index2.html" onclick="changetest()">Navigate</a>
</body>
</html>
common.js
var test="abc";
function changetest(){
test = "xyz";
}
index2.html
<html>
<head>
<script type="text/javascript" src="common.js"></script>
</head>
<body>
<h1>Sample Page2</h1>
<a href="#"><script>document.write(test)</script></a>
</body>
</html>