JavaScript
J6
J5
J4
Component
JavaScript, CSS and SEO
Make CSRF-Protected AJAX Calls with Native Joomla.request()
Sends asynchronous POST requests with automatic CSRF headers and JsonResponse parsing using Joomla native core wrapper.
async function sendVote(endpointUrl, itemId) {
const token = Joomla.getOptions('csrf.token', '');
const body = new URLSearchParams({ id: String(itemId) });
if (token) {
body.set(token, '1');
}
// ...
53
179