Clicker-self reloading button

Hello. I’m trying to make kind of clicker. For that I need a button, which will increase number on click and can show this number at real time without reloading whole page.
I try such way, but it doesn’t work.

  $clicker = $col_2->add(["Button",$_SESSION["i"],"green fluid big"]);
  $clicker->on('click', function ($m) use($clicker) {
    $_SESSION["i"] = $_SESSION["i"] + 1;
    $clicker->js('true', new \atk4\ui\jsReload($clicker));
    return $m;

Any help will be good :slightly_smiling_face:

Hello and welcome,

This will not work unfortunately. The way I would do it is to pass an argument when reloading the clicker as a second argument of the jsReload constructor.

And then on top do something like this:

if ($_GET['increase_counter']) { $_SESSION["i"]++};

If you set up xDebug you will be able to trace the AgileToolkit app workflow much easier.