Quantcast
Channel: phpBB.com
Viewing all articles
Browse latest Browse all 2314

Extension Writers Discussion • Re: How does AJAX work in extensions?

$
0
0
You can create your own ajax function and then trigger it with data-ajax, like:

Code:

<a href="#" data-ajax="toggle_enable">

Code:

phpbb.addAjaxCallback('toggle_enable', function(res) {  'use strict';  var $this = $(this),    newHref = $this.attr('href');  $this.text(res.text);  $this.attr('title', res.title);  if (newHref.indexOf('disable') !== -1) {    newHref = newHref.replace('disable', 'enable');  } else {    newHref = newHref.replace('enable', 'disable');  }  $this.attr('href', newHref);});

Statistics: Posted by MattF — Tue May 13, 2025 12:24 am



Viewing all articles
Browse latest Browse all 2314

Trending Articles