Table of Contents |
---|
...
Variable | Script description | |||||
---|---|---|---|---|---|---|
$jsLoaders | Default loaders that is usually added to the user sections for WordPress. | |||||
$jsLoadersCheckout | Scripts that is only loaded in the head, at checkout section. | |||||
$jsLoadersAdmin | Script loaded in the admin section. | |||||
$jsDependencies | Every script that has dependencies in other scripts should be added here. For example if some of the basic scripts needs jquery it is added like this:
| |||||
$jsDependenciesAdmin | As the regular dependency variable above, but for admin section. | |||||
$styles | Every css that needs to be loaded. | |||||
$stylesAdmin | Css that resides in the admin section. |
...
Nonces are always added in the localizations and the ajaxifier itself so each call can be validated if necessary. For example, when we validate credentials from wp-admin, we always use the nonce to avoid problems.
If you want to take advantage of the nonces in your own calls you simply add 'n' to your payload like this:
Code Block |
---|
getResursAjaxify(
'POST',
'resursbank_do_maths',
{
'firstvalue':2,
'secondvalue':2,
'calctype': 'multiply',
'n': true
},
function(actionResponse) {
// My actions here.
}
); |
And in your API requests, you add this on top of your method.
Code Block |
---|
ResursBank\Module\PluginApi::getValidatedNonce() |