简体   繁体   中英

pass data between two html pages using jquery

How can I pass variables between two html pages using jQuery?

file1.html

<form>
  First name : <input type="text" id="firstname"/>
</form>

file2.html:

<p> <!--retrieve firstname here --> </p>

You could use localStorage:

// Store (on first page)
localStorage.setItem("firstname", "Smith");

// Retrieve (on second page)
var firstname = localStorage.getItem("firstname"); 

More info: http://www.w3schools.com/html/html5_webstorage.asp

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM