Body: <p>I try to load a entry after a button is clicked, currently my code looks like this:</p>
  
  <p>This is generating a 404 error. Dunno why?</p>
  
  <pre><code>&lt;?php
  /**
   * PopUp plugin for Craft CMS 3.x
   *
   * test
   *
   * @link      https://digitalwunder.io
   * @copyright Copyright (c) 2020 digitalwunder.io
   */
  
  namespace digitalwunder\popup;
  
  
  use Craft;
  use craft\base\Plugin;
  use craft\services\Plugins;
  use craft\events\PluginEvent;
  use craft\web\UrlManager;
  use craft\events\RegisterUrlRulesEvent;
  
  use yii\base\Event;
  
  /**
   * Class PopUp
   *
   * @author    digitalwunder.io
   * @package   PopUp
   * @since     0.0.1
   *
   */
  class PopUp extends Plugin
  {
      // Static Properties
      // =========================================================================
  
      /**
       * @var PopUp
       */
      public static $plugin;
  
      // Public Properties
      // =========================================================================
  
      /**
       * @var string
       */
      public $schemaVersion = '0.0.1';
  
      /**
       * @var bool
       */
      public $hasCpSettings = false;
  
      /**
       * @var bool
       */
      public $hasCpSection = false;
  
      // Public Methods
      // =========================================================================
  
      /**
       * @inheritdoc
       */
      public function init()
      {
          parent::init();
          self::$plugin = $this;
  
          Event::on(
              UrlManager::class,
              UrlManager::EVENT_REGISTER_SITE_URL_RULES,
              function (RegisterUrlRulesEvent $event) {
                  $event-&gt;rules['siteActionTrigger1'] = 'pop-up/default';
              }
          );
  
          Event::on(
              UrlManager::class,
              UrlManager::EVENT_REGISTER_CP_URL_RULES,
              function (RegisterUrlRulesEvent $event) {
                  $event-&gt;rules['cpActionTrigger1'] = 'pop-up/default/do-something';
              }
          );
  
          Event::on(
              Plugins::class,
              Plugins::EVENT_AFTER_INSTALL_PLUGIN,
              function (PluginEvent $event) {
                  if ($event-&gt;plugin === $this) {
                  }
              }
          );
  
          Craft::info(
              Craft::t(
                  'pop-up',
                  '{name} plugin loaded',
                  ['name' =&gt; $this-&gt;name]
              ),
              __METHOD__
          );
      }
  
      // Protected Methods
      // =========================================================================
  
      public function actionCheckStatus()
      {
          $this-&gt;requireAcceptsJson();
  
          $response = [
              'status' =&gt; 'open'
          ];
  
          return $this-&gt;asJson($response);
      }
  
  }
  </code></pre>
  
  <p>And the script like this</p>
  
  <pre><code>    &lt;script type="text/javascript"&gt;
        $('#test').click(function(e){
          e.preventDefault()
          var x = {{ entry.id }};
          $.ajax({
              'type': 'post',
              'contentType': 'application/x-www-form-urlencoded; charset=UTF-8',
              'cache': false,
              // 'data': data,
              'url': '/actions/pop-up/checkStatus',
              'dataType': 'json',
              'timeout': 50000
          }).done(function (response) {
            console.log(response);
              // Success
          }).fail(function (error) {
             // Total fail.
          });
        });
      &lt;/script&gt;
  </code></pre>
  
  <p>Can anyone see why I get a 404 error?</p>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2020-05-07T07:35:31.500Z
Comments.Text: Have you tried `/actions/pop-up/check-status` instead of `/actions/pop-up/checkStatus`?
Comments.UserDisplayName: Oli
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2020-05-07T10:22:57.990Z
Comments.Text: @Oli yes same result.
Comments.UserDisplayName: Michael Reich
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2020-05-07T10:24:17.780Z
Comments.Text: Here is a image of the error:
  https://drive.google.com/file/d/1BnRLM3fdO924WJmCJ-bsMvdi9Ag-gvmU/view?usp=sharing
Comments.UserDisplayName: Michael Reich
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2020-05-07T13:52:39.720Z
Comments.Text: I just realise, you don't have a controller in your plugin, do you? You need to make a controller and have you action in there.
Comments.UserDisplayName: Oli
Tags: <plugin-development><ajax>
Title: Load Entries after click (AJAX)
ThreadText: # Load Entries after click (AJAX)
  
  (Asked by: username_0 on 2020-05-06)
  
  I try to load a entry after a button is clicked, currently my code looks like this:
  
  This is generating a 404 error. Dunno why?
  
  ```
  <?php
  /**
   * PopUp plugin for Craft CMS 3.x
   *
   * test
   *
   * @link      https://digitalwunder.io
   * @copyright Copyright (c) 2020 digitalwunder.io
   */
  
  namespace digitalwunder\popup;
  
  use Craft;
  use craft\base\Plugin;
  use craft\services\Plugins;
  use craft\events\PluginEvent;
  use craft\web\UrlManager;
  use craft\events\RegisterUrlRulesEvent;
  
  use yii\base\Event;
  
  /**
   * Class PopUp
   *
   * @author    digitalwunder.io
   * @package   PopUp
   * @since     0.0.1
   *
   */
  class PopUp extends Plugin
  {
      // Static Properties
      // =========================================================================
  
      /**
       * @var PopUp
       */
      public static $plugin;
  
      // Public Properties
      // =========================================================================
  
      /**
       * @var string
       */
      public $schemaVersion = '0.0.1';
  
      /**
       * @var bool
       */
      public $hasCpSettings = false;
  
      /**
       * @var bool
       */
      public $hasCpSection = false;
  
      // Public Methods
      // =========================================================================
  
      /**
       * @inheritdoc
       */
      public function init()
      {
          parent::init();
          self::$plugin = $this;
  
          Event::on(
              UrlManager::class,
              UrlManager::EVENT_REGISTER_SITE_URL_RULES,
              function (RegisterUrlRulesEvent $event) {
                  $event->rules['siteActionTrigger1'] = 'pop-up/default';
              }
          );
  
          Event::on(
              UrlManager::class,
              UrlManager::EVENT_REGISTER_CP_URL_RULES,
              function (RegisterUrlRulesEvent $event) {
                  $event->rules['cpActionTrigger1'] = 'pop-up/default/do-something';
              }
          );
  
          Event::on(
              Plugins::class,
              Plugins::EVENT_AFTER_INSTALL_PLUGIN,
              function (PluginEvent $event) {
                  if ($event->plugin === $this) {
                  }
              }
          );
  
          Craft::info(
              Craft::t(
                  'pop-up',
                  '{name} plugin loaded',
                  ['name' => $this->name]
              ),
              __METHOD__
          );
      }
  
      // Protected Methods
      // =========================================================================
  
      public function actionCheckStatus()
      {
          $this->requireAcceptsJson();
  
          $response = [
              'status' => 'open'
          ];
  
          return $this->asJson($response);
      }
  
  }
  
  ```
  
  And the script like this
  
  ```
      <script type="text/javascript">
        $('#test').click(function(e){
          e.preventDefault()
          var x = {{ entry.id }};
          $.ajax({
              'type': 'post',
              'contentType': 'application/x-www-form-urlencoded; charset=UTF-8',
              'cache': false,
              // 'data': data,
              'url': '/actions/pop-up/checkStatus',
              'dataType': 'json',
              'timeout': 50000
          }).done(function (response) {
            console.log(response);
              // Success
          }).fail(function (error) {
             // Total fail.
          });
        });
      </script>
  
  ```
  
  Can anyone see why I get a 404 error?
  
  **Tags:** plugin-development, ajax
  
  > **Comments:**
  > **username_1**: Have you tried `/actions/pop-up/check-status` instead of `/actions/pop-up/checkStatus`?  
  > **username_0**: @username_1 yes same result.  
  > **username_0**: Here is a image of the error: https://drive.google.com/file/d/1BnRLM3fdO924WJmCJ-bsMvdi9Ag-gvmU/view?usp=sharing  
  > **username_1**: I just realise, you don't have a controller in your plugin, do you? You need to make a controller and have you action in there.  
  
  ---
  
  ## 0 answers
  
  