0

Maybye someone can help me. I have a search engine that shows results from json. I'm doing pagination for these results. I have the search results in json value: "query": "offset = 10 & hits = 10 & q = aaa". After clicking on the next page in pagination I would like to add the query result to url 'https://xyz' and change the value 'q' to 'query'. I would like to get result like this:https://xyz?offset=10&hits=10&query=aaa

1 Answers1

0

You can change the url using location.href in JavaScript, but it will reload the page entirely so if you want to maintain scroll position you might add a query parameter for that as well.

Resources https://www.w3schools.com/jsref/prop_loc_href.asp

JavaScript get window X/Y position for scroll

Jtbs
  • 181
  • 9