I have two Java scripts file say ''one.js'' and "two.js".

There is a function in "one.js" named "setData()" that is defined below

function setData(){
sessionStorage.setItem("urldata", url);

Similarly, there is a function "getData()" given below defined in "two.js"

function getData(){



But by some how, I am unable to get value in getData(). It seems, sessionStorage.getItem("urldata") is not working. However, if I write getData() in the file "one.js" then it works.

Please advise what is wrong with this code.