-1

I'm trying to copy information from one page and use it on another page, but I keep getting "null" for my variable. I tried to use localStorage as a way to designate a global variable, that that's also not working and still returning null.

Is there a proper way to do this?

$( document ).ready(function() {
    if  ($(".panel-body").length) {
        var ip = $( "td:eq( 1 )" ).text();
        localStorage.setItem("ip", ip);
    }

    var ip = localStorage.getItem("ip");

    $("input[name=ip]").val(ip)
});
Brock Adams
  • 86,878
  • 22
  • 220
  • 282
MDev20
  • 597
  • 3
  • 16
  • Clarify: (1) which of those nodes is on which page? (2) are the page domains *and sub-domains* ***exactly*** the same? – Brock Adams Feb 19 '15 at 07:20

1 Answers1

-1

can you put a breakpoint on

localStorage.setItem("ip", ip);

to see if it gets hit and ip is not null?

nuway
  • 2,222
  • 4
  • 26
  • 48