0

am having few check boxes on my web page and related data (few products) according to the selection of check boxes and basically products data is result of ajax call from these check boxes and i am changing the url of browser by attaching query string params using window.history.pushState. it's working fine but the problem is when i tried clicking back / front button of browser. selection of check boxes still showing latest selected ones not the previous selection

state-1: First selection url:http://localhost:1234/Brands?Color=Peach and corresponding filter img below

enter image description here

state-2: Second selection url:http://localhost:1234/Brands?Color=Peach%2CPink%2FWhite and corresponding filter img below

enter image description here

now when i click browser back button i am getting url changes to state 1 but my filter selection is remain same like

state-3: (back button click on browser) url:http://localhost:1234/Brands?Color=Peach

enter image description here

how to get the previous state, again i need to find all query params in url and do uncheck operation or else any way is there is to do it ??

Ray
  • 188
  • 2
  • 17
  • if everytime you are about to pass in GET peram. you could try read GET value from URL and on page load change checkbox state. For more how to read Value from peram. follow this link http://stackoverflow.com/questions/19491336/get-url-parameter-jquery-or-how-to-get-query-string-values-in-js – Shivam Pandya Feb 17 '17 at 06:20
  • Can you show the HTML you have so far for this? – caramba Feb 17 '17 at 06:25
  • @ Shivam Pandya u mean, what i have mentioned in my last few line, yeh but is there any other way kind of get the previous state of check boxes ??. – Ray Feb 17 '17 at 06:26

0 Answers0