We are pleased to announce that included in v3 onwards, October CMS ships with a new AJAX framework that removes the need to include jQuery in your themes. The new framework is a drop-in replacement for the old one and includes ongoing support for both jQuery and Vanilla JS.
The AJAX framework library contains four main components:
||Applies data attributes API to the DOM.|
||Applies extra AJAX features to the DOM.|
||Applies the PJAX library to the DOM.|
It is possible to import the framework as a module for build tools like webpack:
npm install --save octobercms
Then require it in your scripts:
var oc = require('octobercms');
The code for the AJAX Framework is public and can be found at the following GitHub repo:
If your website or application is affected by this change, we recommend disabling PJAX by including the following META tag in your webpage layouts.
<head> <meta name="turbo-visit-control" content="disable" /> </head>
If there are affected plugins, you may also disable the turbo router in the backend with the
// config/backend.php // 'turbo_router' => false,
Plugin developers can disable PJAX on specific controllers by including the
/** * @var bool turboVisitControl forces a reload */ public $turboVisitControl = 'disable';
We encourage you to learn more about introducing PJAX support by reading the documentation.
There is only one significant breaking change to the
error function signature. The argument order has changed and this is an intentional break to make the API more consistent. Also - the
textStatus (provided by jQuery) has been replaced with the HTTP response code.
success: function(data, textStatus, jqXHR) complete: function(data, textStatus, jqXHR) error: function(jqXHR, textStatus, errorThrown)
success: function(data, responseCode, xhr) complete: function(data, responseCode, xhr) error: function(data, responseCode, xhr)
The method signatures are now consistent across the board.