refresh page without losing form data javascript

0
()

refresh page without losing form data javascript – The easiest way to reload the current page without losing form data.

refresh page without losing form data javascript

Here are ways of executing a javascript function on form submit without reload the html page.How to Submit a Form Submit Without Page Refresh using AJAX with javascript and PHP.

How to reload the current page without losing any form data with HTML?

window.onbeforeunload = function() {
   localStorage.setItem(name, $('#inputName').val());
   localStorage.setItem(mobile, $('#inputmobile').val());
   localStorage.setItem(subject, $('#inputAddress').val());
}

window.onload = function() {
   var name = localStorage.getItem(name);
   var mobile = localStorage.getItem(mobile);
   if (name !== null) $('#inputName').val(name); if (mobile !== null) $('#inputmobile').val(mobile);
   // ...
}

refresh a page in jquery

$('#selectPlayer').click(function() {
    location.reload();
});

How to refresh a page using jQuery?

<!DOCTYPE html>
<html>

<head>
	<title>How to refresh a page using jQuery? - www.pakainfo.com</title>
	
	<script src=
		"https://code.jquery.com/jquery-3.3.1.min.js">
	</script>
</head>

<body>
	<h2 style="color: green">
		Pakainfo.com
	</h2>
	
	<b>
		How to refresh a page using jQuery?
	</b>
	
	<p>
		Pakainfo.com website focuses on all web language and framework tutorial PHP, Laravel, Codeigniter, Nodejs, API, MySQL, AJAX, jQuery, JavaScript, Demo.

	</p>
	
	<button type="button">
		Button to Reload page
	</button>

	<script type="text/javascript">
		$(document).ready(function () {
			$("button").click(function () {
				location.reload(true);
				alert('Reloading Page');
			});
		});
	</script>
</body>

</html>					

Don’t Miss : Jquery Reload Page Automatically Example

Free Live Chat for Any Issue
Download

I hope you get an idea about refresh page without losing form data javascript.
I would like to have feedback on my infinityknow.com.
Your valuable feedback, question, or comments about this Article are always welcome.
If you enjoyed and liked this post, don’t forget to share.

Read Also:  PHP mysqli insert update delete for Dynemic query

How useful was this post?

Click on a star to rate it!