Answers.Body: <p>I'd suggest generating the code via <a href="https://pluginfactory.io/" rel="nofollow noreferrer">pluginfactory.io</a> and if you have code comments enabled, it'll give you the URI that you need to trigger your action in the example code.</p>
  <p>But essentially it's going to be a kebab-case version of your controller route, with a kebab-case version of your method name (but removing the action preface).</p>
  <p>For you, first you should rename your method thusly:</p>
  <pre class="lang-php prettyprint-override"><code>    public function actionBuu() {
          echo &quot;tradada&quot;;
      }
  </code></pre>
  <p>And then your URI would be something like:</p>
  <pre><code>/actions/dns-notifier/dns-notifier-controller-db-controller/buu
  </code></pre>
  <p>See here for more on <a href="https://www.yiiframework.com/doc/guide/2.0/en/structure-controllers" rel="nofollow noreferrer">controller actions</a></p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-08-13T14:24:51.090Z
Answers.LastActivityDate: 2020-08-13T14:24:51.090Z
Answers.UserDisplayName: andrew.welch
Body: <p>I have a simple controller in /craft/plugins/craft-dns-notifier/src/conrollers/DnsNotifierController:</p>
  <pre><code>namespace kokesjan\dnsnotifier\controllers;
  use craft\web\Controller;
  
  class DnsNotifierController_DbController extends Controller
  {
      public function buu() {
          echo &quot;tradada&quot;;
      }
  }
  </code></pre>
  <p>I would like to access the buu() action from src/templates/index.html twig file via Ajax.</p>
  <p>I've had no luck for three days, unable to find any hint anywhere. Nothing I have tried worked. It seems like very easy task to me, but I just can't make it work.</p>
  
Tags: <ajax>
Title: Plugin development - How to access actions?
ThreadText: # Plugin development - How to access actions?
  
  (Asked by: username_0 on 2020-08-13)
  
  I have a simple controller in /craft/plugins/craft-dns-notifier/src/conrollers/DnsNotifierController:
  
  ```
  namespace kokesjan\dnsnotifier\controllers;
  use craft\web\Controller;
  
  class DnsNotifierController_DbController extends Controller
  {
      public function buu() {
          echo "tradada";
      }
  }
  
  ```
  
  I would like to access the buu() action from src/templates/index.html twig file via Ajax.
  
  I've had no luck for three days, unable to find any hint anywhere. Nothing I have tried worked. It seems like very easy task to me, but I just can't make it work.
  
  **Tags:** ajax
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2020-08-13. Score: 1
  
  I'd suggest generating the code via [pluginfactory.io](https://pluginfactory.io/) and if you have code comments enabled, it'll give you the URI that you need to trigger your action in the example code.
  
  But essentially it's going to be a kebab-case version of your controller route, with a kebab-case version of your method name (but removing the action preface).
  
  For you, first you should rename your method thusly:
  
  ```php
      public function actionBuu() {
          echo "tradada";
      }
  
  ```
  
  And then your URI would be something like:
  
  ```
  /actions/dns-notifier/dns-notifier-controller-db-controller/buu
  
  ```
  
  See here for more on [controller actions](https://www.yiiframework.com/doc/guide/2.0/en/structure-controllers)
  
  
  ---
  
  