I\'ve come across a problem that if I use jQuery\'s Get method to get some content, if I click back, instead of it actually going back one page in the history, it instead sh
The @abraham's answer is right.
I just wanted to post a solution for Rails: all you need is just add different path to routes.rb
.
In example, I have resource :people
and I want to compose index page from ajax parts one of those is list of people. The straightforward way is to create index.js.erb
and to load partial via ajax using url: people_path
. But here occurs the issue.
So, for Rails, it needs just add a different route, like
get 'people_list', to: 'people#index', as: :people_list, format: :js
Just add the following header to the Response headers :
Vary: Accept