onpopstate returning data twice
I've started to play around with onpopstate but ran into a problem. Whenever I click the back button on my browser, the url does change accordingly but the page code is loaded twice so I receive two lists and two div's. Why is is it producing double the code and how do I fix it? The sample code is below.
Here is the contents of 1.php
Here is a link to some screenshots I took of what visually happens. The first image is when I first load the screen. the second image is what happens when I press the button 1. The third image is what happens when I click back on my browser.
According to the problem sequence you describe, onpopstate will load the contents of test1.php into the #insert div. Since the landing page was also test1.php this will result in the duplication seen in your screenshots.
You could make this someone else's problem by using jquery-pjax. If you're not tied to jquery there are also other solutions out there that are probably easier than rolling your own.