> For the complete documentation index, see [llms.txt](https://javascriptuse.gitbook.io/javascript/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://javascriptuse.gitbook.io/javascript/how-to-pass-data-from-one-page-to-another-page-html-ok.md).

# How to pass data from one page to another page html (ok)

C:\xampp\htdocs\ajaxsubmit\page1.html

```
<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<meta name="viewport" content="width=device-width, initial-scale=1.0">
	<title>Document</title>
</head>
<body>
	<script type="text/javascript">
		var firstData = {
		    'key1' : 'value1',
		    'key2' : 'value2'
		};
		var secondData = {
		    'key1' : 'value3',
		    'key2' : 'value4'
		};
		var myData = JSON.stringify([ firstData, secondData ]);
		localStorage.setItem( 'objectToPass', myData );
	</script>
</body>
</html>
```

C:\xampp\htdocs\ajaxsubmit\page2.html

```
<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<meta name="viewport" content="width=device-width, initial-scale=1.0">
	<title>Document</title>
</head>
<body>
	<script type="text/javascript">
		// Get the variable
		var myData = localStorage['objectToPass'];
		// localStorage.removeItem( 'objectToPass' );
		console.log(myData);
	</script>
</body>
</html>
```
