I need to change the current url after a form has been submitted using an AJAX GET request.
I've tried to use history.pushState(null, null, url+'?'+form.serialize())
and it works fine. The problem is that what I'm retrieving is only a subset of the page, therefore the browser will display that subset instead of the whole page when navigating through history.
I like history.pushState
approach, but it doesn't look viable; do you know any better way? Or, even better, do you know how to save the whole content of the page instead of the subset?
The url I need to get is mydomain.com/some-page?variable=1&varialbe_2=2
To give you more informations: the controller method I need to access detects if the route has been called by an Ajax request, and if it has the response will be json. Otherwise it will load the whole page normally.
Thanks for any help you can give.