Skip to content Skip to sidebar Skip to footer

How To Pass Value From One Html Page To Another In Javascript?

I know this question ask many times but my question is something different. I have 3 html pages like apply.html, personal_info.html, resume info.html. In apply.html page:-

Solution 1:

You could use the HTML5 local storage. It lets you tell the browser to save data on the user's machine. (There's also session storage, valid only for the current session.)

Save (in Apply.html)

IN.API.Profile("me")
.fields(["id", "firstName", "lastName", "pictureUrl","headline","industry","location:(name)","positions:(title)","emailAddress"])
  .result(function(result) {
      profile = result.values[0];

      // save all keys to local storagefor (f in profile) localStorage[f] = fields[f];

      // more stuff ...
  });

Retrieve (in personal_Info.html)

// retrieve first name from local storagevar firstName = localStorage["firstName"];
if (firstName !== undefined) {
    $("#textfield1").attr(value, firstName);
}

Solution 2:

Well you can use HTML5 session storage. Check this link.

Just dig around on HTML5 session storage and you will find a lot of examples.

Post a Comment for "How To Pass Value From One Html Page To Another In Javascript?"