0

I'm trying to get pjax to work on a Rails app but none of the links are being annotated with pjax. I think pjax isn't really being loaded. I'm using pjax_rails and am basically following the railscast instructions but using //= require jquery.pjax instead of just pjax. I'm also using it with bootstrap which may cause an issue but I'm not sure. My other thought is that is that the pjax javascript isn't being loaded and I need to run something like $('a').pjax('[data-pjax-container]')

To be clear the main problem is that pjax isn't being loaded client side and thus when I make requests the X-PJAX header is not being set.

4

1 回答 1

0

终于让它工作了。第一个问题是我不知道资产管道已关闭,因此未包含 pjax javascript 文件。相反,我使用了 pjax rack gem 并将其转储到公共目录中。然后我创建了一个新的 javascript 文件,$('a').pjax('[data-pjax-container]')它可以工作了!虽然我不确定为什么当所有文档似乎都指向它应该已经存在的事实时我需要手动调用该 javascript。

于 2012-07-04T01:07:05.333 回答