I've I'm getting a href value from a loaded AJAX page: and every time I load an AJAX page, it gets the value from the newly loaded page.
I use this to get the right href value:
firstURL = l[0].childNodes[0].attributes[0].nodeValue;
However, on the last page, this node does not exist (because we're on the last page), and returns:
Uncaught TypeError: Cannot read property 'attributes' of undefined trans.js:393
(anonymous function) trans.js:393
j jquery.min.js:2
k.fireWith jquery.min.js:2
x jquery.min.js:4
(anonymous function)
Is there a way for me to assign this variable, if the child node l[0].childNodes[0].attributes[0].nodeValue exists?
var firstURL = l[0].childNodes[0] ? l[0].childNodes[0].attributes[0].nodeValue : null;