Package Data | |
---|---|
Maintainer Username: | JacobBennett |
Maintainer Contact: | me@jakebennett.net (Jacob Bennett) |
Package Create Date: | 2015-02-24 |
Package Last Update: | 2020-03-10 |
Home Page: | |
Language: | PHP |
License: | MIT |
Last Refreshed: | 2024-12-22 15:04:14 |
Package Statistics | |
---|---|
Total Downloads: | 39,326 |
Monthly Downloads: | 241 |
Daily Downloads: | 0 |
Total Stars: | 116 |
Total Watchers: | 8 |
Total Forks: | 19 |
Total Open Issues: | 0 |
Enable the use of PJAX in Laravel 5.*.
Add jacobbennett/pjax
to require
section in your composer.json
"jacobbennett/pjax": "~1.0"
Add 'JacobBennett\Pjax\PjaxMiddleware',
to $middleware
in app/Http/Kernel.php
This middleware will check, before outputting the http response, for the X-PJAX
's
header in the request. If found, it will crawl the response to return the requested
element defined by X-PJAX-Container
's header.
jQuery PJAX JS is required to use this package jquery.pjax.js.
See an example on Laracasts
Sometimes when using PJAX it will timeout and trigger a standard page reload. This could be due to various factors but one thing you may try is to extend the default timeout for PJAX using this little snippet when you initialize PJAX.
$(document).ready(function(){
// does current browser support PJAX
if ($.support.pjax) {
$.pjax.defaults.timeout = 1000; // time in milliseconds
}
});