Click here to Skip to main content
15,886,519 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have a web application that loads div pages in a div container but when i refresh that page the div goes to the first loaded div. i would like to keep the current selected div even after page is refreshed. Any help will be apricated.


What I have tried:

$('ul#nav li a').click(function(){
				var page = $(this).attr('href');
               var sp = $("#sp").val();
 var mo = $("#mo").val();   
 var ut = $("#ut").val();
				$('#main-content').load(''+ page +'.php', {sp: sp,ut: ut,mo: mo});
				return false;
			});
Posted
Updated 29-May-22 4:42am
Comments
Sandeep Mewara 24-Apr-22 23:47pm    
Not sure of your exact need. If location.reload(); doesn't work on an expected event, you would need to maintain the state in order to achieve it.

Store(keep updating) current selected div every time you change div. During page load (first time or refresh) - refer the stored data to bring that into focus/view.

1 solution

Hello ezrasoft !

the only way to store the state of a page is to transmit it.

you have few container available by web technologies.

- server sided cache ( db / session var / user dedicated files )
- web browser cache with fixed page ( it's html js resource )
- storing datas in a file at 'client level' then reload it ( js )
- using cookies as container, then reload datas in. ( js )
- submit the page to self ( and datas in same time ).
- xml style ( rss feed by file )


those are few ways to achieve, choose one .
 
Share this answer
 
v3

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900