In my rails application, I’ve begun to tinker with AJAX for the first time and although I have it working wonderfully, it has one unusual behavior: Hitting back or forward after using an AJAX link will give you only the unrendered AJAX-pulled partial in plain text form.
How does one fix this? I can’t find anything on Google pertaining to this particular problem.
For any others with this problem, I found the culprit. There were a couple javascript links on the page with their hrefs set to
#which messes with the browser’s history when clicked. Replacing#withjavascript:void(0)fixes the problem, giving the expected AJAX history behavior.