I am trying to handle the popstate event.The problem is that in the same page i use links like:
So i have 2 ajax functions to load contents for each of above examples.When i press the back button of browser, i go back with 2 different ways:
or
How can i check every time the url and according to this, call one of my 2 ajax functions to load the correct content?
You could use the window.location object to retrieve the current URL https://developer.mozilla.org/fr/docs/Web/API/window/location