Questions tagged [pjax]

pjax is a jQuery plugin that loads HTML from your server into the current page without a full reload. It's ajax with real permalinks, page titles, and a working back button that fully degrades.

pjax is a jQuery plugin that uses ajax and pushState to deliver a fast browsing experience with real permalinks, page titles, and a working back button.

pjax works by grabbing html from your server via ajax and replacing the content of a container on your page with the ajax'd html. It then updates the browser's current url using pushState without reloading your page's layout or any resources (js, css), giving the appearance of a fast, full page load. But really it's just ajax and pushState.

References

507 questions
36
votes
5 answers

Is pjax the way to go for "fluid" navigation?

I've started playing with pjax, as I want to provide a fast, fluid experience for my users without a lot of unnecessary HTTP requests and repeated rendering of unchanged HTML. I have it working fairly well on my site, and I must say it was…
Jerad Rose
  • 15,235
  • 18
  • 82
  • 153
24
votes
6 answers

Desperately need a solution for Adsense that works with Ajax

I know this questions has been asked a few times here. But these seem fairly outdated, and it looks like the Adsense for Ajax project has been canned (or at the very least, moving very slowly). I have a web site that I've recently integrated pjax…
Jerad Rose
  • 15,235
  • 18
  • 82
  • 153
22
votes
2 answers

history.pushState - not working?

I want to change html without reload. I do it like: $('#left_menu_item').click(function(e) { if (!!(window.history && history.pushState)) { e.preventDefault(); history.pushState(null, null, newUrl); } }); It works correctly.…
indapublic
  • 2,208
  • 9
  • 38
  • 49
22
votes
2 answers

PJAX: Problems with back button

Some our links are wrapped by PJAX. When a user clicks on a PJAX link the server returns only the required part of the HTML. If I do the following: Click PJAX link Click simple link Press back button the browser will display content that was…
fedor.belov
  • 22,343
  • 26
  • 89
  • 134
18
votes
3 answers

Where to put the page-initialize javascript when using pjax?

Most of the times, I put some javascript code in $(document).ready to do some initialization stuffs on the page, like event binding, etc. But now I would like to use pjax https://github.com/defunkt/jquery-pjax for some of my pages. With pjax,…
larryzhao
  • 3,173
  • 2
  • 40
  • 62
16
votes
4 answers

Using Pjax in YII2 for updating a div

I'm trying to use Pjax widget in a yii2 project. My goal is to update the div #formsection with some content. My code: View
$name): ?>
ahb360
  • 373
  • 1
  • 3
  • 10
16
votes
2 answers

Jquery Pjax - Ajax success function

Currently I am translating my ajax calls to regular $.pjax() call. Everything works fine but ajax success function. I can't manage how to call pjax success function with given parameters. The only thing I can use is defining pjax global success…
even2be
  • 415
  • 1
  • 3
  • 7
15
votes
2 answers

pjax still does full page reload

I have tried pjax examples in chrome and firefox, i took the sample code and placed it into my own app but it still does a full page reload. The AJAX request happens then the page moves on without updating the #main div …
Chris Mccabe
  • 1,902
  • 6
  • 30
  • 61
12
votes
1 answer

Disable pjax loading on certain buttons inside Pjax container (Yii2)

I need to disable pjax inside pjax container on some anchor tags like cancel/ back button. Below is my code: Pjax::begin(['id' => 'pjax-container-pac-form','timeout' => 10000, 'enablePushState' => false]); $form = ActiveForm::begin([ 'options' => [ …
Vipul
  • 655
  • 2
  • 6
  • 22
12
votes
5 answers

How to ignore popstate initial load, working with pjax

I have been trying to get the forward an back browser buttons to work on a small site using pjax and have come up with the following code to handle class changes and fading in and out the various overlays. However I have found that Chrome and…
Sam Quayle
  • 537
  • 5
  • 16
11
votes
3 answers

Pjax animations

I finally got pjax working, but I have another question.. How do I add some jquery animation like fadeout/slideup old content and fadein/slidedown new content? By default pjax just changes the content without any good looking effects.. Any help…
Maja Jelen
  • 223
  • 5
  • 13
11
votes
2 answers

jquery pjax request sending twice

I have a rails app and I keep getting a weird behavior with pjax requests. When I look into my development logs I could see that two requests are being made. The first request is pjax and the next one is not. As a result the page still reloads. I…
Lester Celestial
  • 1,454
  • 1
  • 16
  • 26
11
votes
1 answer

How to use PJAX? (PJAX With PHP?)

I was trying to get PJAX working with my PHP site, this is the code I am using for it: