defunkt/jquery-pjax — Issue #89: Unsightly _pjax=true parameter in link URLs after pjaxing
Author: henrik
Created: 2012-02-05 17:38:26+00:00
State: open

Figured out the solution myself, but putting it here for googleability if someone else has the same problem.

We saw the following behavior: if I'm on page `/a` and click a pjax link to page `/b`, everything is fine. But when I click a link from there on to page C, the link will say `/c?_pjax=true` and that's the URL I will see after following it.

The problem is simply that since pjax adds the _pjax=true parameter for caching in its JSON request, the links in your view may render with that parameter included, depending on how you generate their URLs.

What I did in Ruby on Rails was simply a `params[:_pjax] = nil` in the controller (a before filter might be appropriate) before rendering the view. Doesn't interfere with the caching but helps the links render without that parameter.