Link To Go To Controller

hello,

Im trying to create a link to go to controller end get information to display in a html block.

when I click the link I got a 200 ok and it will go to controller and get the info but the html wont update.

here is the code:

  • {$li}
  • 22222222222
  • 33333333333
  • and controller:
    $a = 1111;
    if($_REQUEST['test'] == 1){
    $a = 'aaaaaaaaaaaa';
    Registry::get('view')->assign('li', $a);
    Registry::get('ajax')->assign('li', $a);
    }
    what is missing here ?

    The code in the template should be:

    xxxxxxxxxxxxxxxxxxx
    
    • {$li}
    • 22222222222
    • 33333333333

    I dont know why but this is not working for me.

    I have this test:

    xxxxxxxxxxxxxxxxxxx

    on controller I have this:

    $a = 1111;
    if($_REQUEST['test'] == 1){
    $a = 'hello from controller';
    Registry::get('ajax')->assign('li', $a);
    }
    I can see the "hello from controller" in the chrome network tab, on PREVIEW tab:
    1. {li: "hello from controller",…}
      1. current_url: "http://localhost/pmi/ecom-sp/backend.php?dispatch=index&test=1"
      2. li: "hello from controller"
    how can I get the value that is beeing returned ?
    Thanks

    At first view, I can see that the data-ca-target-id parameter is missed. It specify the ID of the element which should be updated after ajax request