Magento2 ajax fails in adminMagento 2 Ajax request failsTrying to run an AJAX script from the admin area in magentoMagento 2 Custom Admin Action Redirected to DashboardMagento2: How make public a backend route?I created a custom module ,but getting error, not able to figure out what the error is about. How to get out of this error?main.CRITICAL: Plugin class doesn't existCustom module controller not working magento2Magento 2 admin form controller errorMagento 2.2.5: Overriding Admin Controller sales/orderMagento 2.2.5: Add, Update and Delete existing products Custom OptionsMagento 2.3 Can't view module's front end page output?

Why is it that I can sometimes guess the next note?

Plot of a tornado-shaped surface

How do I delete all blank lines in a buffer?

creating a ":KeepCursor" command

On a tidally locked planet, would time be quantized?

How do you respond to a colleague from another team when they're wrongly expecting that you'll help them?

Why is this estimator biased?

Does Doodling or Improvising on the Piano Have Any Benefits?

How much character growth crosses the line into breaking the character

Probability that THHT occurs in a sequence of 10 coin tosses

Lowest total scrabble score

Pre-mixing cryogenic fuels and using only one fuel tank

What are the advantages of simplicial model categories over non-simplicial ones?

Does IPv6 have similar concept of network mask?

Using substitution ciphers to generate new alphabets in a novel

Unexpected behavior of the procedure `Area` on the object 'Polygon'

Has any country ever had 2 former presidents in jail simultaneously?

Why "had" in "[something] we would have made had we used [something]"?

How to cover method return statement in Apex Class?

What is going on with 'gets(stdin)' on the site coderbyte?

What does "Scientists rise up against statistical significance" mean? (Comment in Nature)

Mimic lecturing on blackboard, facing audience

Quoting Keynes in a lecture

How to say when an application is taking the half of your screen on a computer



Magento2 ajax fails in admin


Magento 2 Ajax request failsTrying to run an AJAX script from the admin area in magentoMagento 2 Custom Admin Action Redirected to DashboardMagento2: How make public a backend route?I created a custom module ,but getting error, not able to figure out what the error is about. How to get out of this error?main.CRITICAL: Plugin class doesn't existCustom module controller not working magento2Magento 2 admin form controller errorMagento 2.2.5: Overriding Admin Controller sales/orderMagento 2.2.5: Add, Update and Delete existing products Custom OptionsMagento 2.3 Can't view module's front end page output?













1















In admin I have the following controller:



<?php
namespace VendorModuleControllerAdminhtml;

use MagentoBackendAppActionContext;

class Test extends MagentoBackendAppAction

/**
* @var MagentoFrameworkViewResultPageFactory
*/
protected $resultPageFactory;

/**
* @param MagentoBackendAppActionContext $context
*/
public function __construct(
Context $context,
MagentoFrameworkControllerResultJsonFactory $resultJsonFactory
)
parent::__construct($context);
$this->resultJsonFactory = $resultJsonFactory;


public function execute()

return $this->resultJsonFactory->create()->setData([
'this' => 'test'
]);




in Vendor/Module/etc/adminhtml/routes.xml I have:



<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:App/etc/routes.xsd">
<router id="admin">
<route id="module" frontName="module">
<module name="Vendor_Module" />
</route>
</router>
</config>


In javascript I do the following ajax request to that controller:



jQuery.ajax( 
url: location.protocol + '//' + location.host+'/admin/module/test',
data: form_key: window.FORM_KEY,
type: 'POST'
).done(function(a)
console.log(a);
);


And I receive 404 error



http://mydomain/admin/module/test?isAjax=true 404 (Forbidden)


as well.. same thing...



Why is this happening ?










share|improve this question




























    1















    In admin I have the following controller:



    <?php
    namespace VendorModuleControllerAdminhtml;

    use MagentoBackendAppActionContext;

    class Test extends MagentoBackendAppAction

    /**
    * @var MagentoFrameworkViewResultPageFactory
    */
    protected $resultPageFactory;

    /**
    * @param MagentoBackendAppActionContext $context
    */
    public function __construct(
    Context $context,
    MagentoFrameworkControllerResultJsonFactory $resultJsonFactory
    )
    parent::__construct($context);
    $this->resultJsonFactory = $resultJsonFactory;


    public function execute()

    return $this->resultJsonFactory->create()->setData([
    'this' => 'test'
    ]);




    in Vendor/Module/etc/adminhtml/routes.xml I have:



    <?xml version="1.0"?>
    <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:App/etc/routes.xsd">
    <router id="admin">
    <route id="module" frontName="module">
    <module name="Vendor_Module" />
    </route>
    </router>
    </config>


    In javascript I do the following ajax request to that controller:



    jQuery.ajax( 
    url: location.protocol + '//' + location.host+'/admin/module/test',
    data: form_key: window.FORM_KEY,
    type: 'POST'
    ).done(function(a)
    console.log(a);
    );


    And I receive 404 error



    http://mydomain/admin/module/test?isAjax=true 404 (Forbidden)


    as well.. same thing...



    Why is this happening ?










    share|improve this question


























      1












      1








      1








      In admin I have the following controller:



      <?php
      namespace VendorModuleControllerAdminhtml;

      use MagentoBackendAppActionContext;

      class Test extends MagentoBackendAppAction

      /**
      * @var MagentoFrameworkViewResultPageFactory
      */
      protected $resultPageFactory;

      /**
      * @param MagentoBackendAppActionContext $context
      */
      public function __construct(
      Context $context,
      MagentoFrameworkControllerResultJsonFactory $resultJsonFactory
      )
      parent::__construct($context);
      $this->resultJsonFactory = $resultJsonFactory;


      public function execute()

      return $this->resultJsonFactory->create()->setData([
      'this' => 'test'
      ]);




      in Vendor/Module/etc/adminhtml/routes.xml I have:



      <?xml version="1.0"?>
      <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:App/etc/routes.xsd">
      <router id="admin">
      <route id="module" frontName="module">
      <module name="Vendor_Module" />
      </route>
      </router>
      </config>


      In javascript I do the following ajax request to that controller:



      jQuery.ajax( 
      url: location.protocol + '//' + location.host+'/admin/module/test',
      data: form_key: window.FORM_KEY,
      type: 'POST'
      ).done(function(a)
      console.log(a);
      );


      And I receive 404 error



      http://mydomain/admin/module/test?isAjax=true 404 (Forbidden)


      as well.. same thing...



      Why is this happening ?










      share|improve this question
















      In admin I have the following controller:



      <?php
      namespace VendorModuleControllerAdminhtml;

      use MagentoBackendAppActionContext;

      class Test extends MagentoBackendAppAction

      /**
      * @var MagentoFrameworkViewResultPageFactory
      */
      protected $resultPageFactory;

      /**
      * @param MagentoBackendAppActionContext $context
      */
      public function __construct(
      Context $context,
      MagentoFrameworkControllerResultJsonFactory $resultJsonFactory
      )
      parent::__construct($context);
      $this->resultJsonFactory = $resultJsonFactory;


      public function execute()

      return $this->resultJsonFactory->create()->setData([
      'this' => 'test'
      ]);




      in Vendor/Module/etc/adminhtml/routes.xml I have:



      <?xml version="1.0"?>
      <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:App/etc/routes.xsd">
      <router id="admin">
      <route id="module" frontName="module">
      <module name="Vendor_Module" />
      </route>
      </router>
      </config>


      In javascript I do the following ajax request to that controller:



      jQuery.ajax( 
      url: location.protocol + '//' + location.host+'/admin/module/test',
      data: form_key: window.FORM_KEY,
      type: 'POST'
      ).done(function(a)
      console.log(a);
      );


      And I receive 404 error



      http://mydomain/admin/module/test?isAjax=true 404 (Forbidden)


      as well.. same thing...



      Why is this happening ?







      magento2 admin ajax






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Sep 5 '17 at 12:09









      Irini Koutaki

      3612




      3612










      asked Feb 23 '16 at 15:01









      Lachezar RaychevLachezar Raychev

      66731435




      66731435




















          5 Answers
          5






          active

          oldest

          votes


















          1














          you should make the call to location.protocol + '//' + location.host+'/admin/vendor/module/test'



          [EDIT]

          or try
          location.protocol + '//' + location.host+'/admin/module/test'






          share|improve this answer

























          • nope... didnt work, same thing - 404 forbidden

            – Lachezar Raychev
            Feb 23 '16 at 15:08











          • how does your etc/adminhtml/routes.xml file look like?

            – Marius
            Feb 23 '16 at 15:10











          • <?xml version="1.0"?> <config xmlns:xsi="w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:App/etc/routes.xsd"> <router id="admin"> <route id="module" frontName="module"> <module name="Vendor_Module" /> </route> </router> </config>

            – Lachezar Raychev
            Feb 23 '16 at 15:12












          • see my edit. If that does not work, I'm out of ideas.

            – Marius
            Feb 23 '16 at 15:15











          • sadly, it didn't ... :( 10x anyway the weirdest error though ... 404 Forbidden... I've never seen this before

            – Lachezar Raychev
            Feb 23 '16 at 15:19



















          2














          I had the same issue. The reason could be, that the formkey is invalid, because it is not added to the url.



          My advice:



          • Do not use location.protocol or something else like location.host

          • Instead let the url be generated by PHP and then pass it to javascript in phtml file or as a variable (for example in a function created by block).

          Creation in PHP (from block) is:



          $this->getUrl('frontname/myController', $params )


          where:




          • frontname is defined in your route-file etc/adminhtml/routes.xml,


          • $params are the post-parameters (can be an empty array).

          Also it can be a cache-problems:



          • Check if you have caches disabled

          • run the command: php bin/magento cache:clean

          • run the command: rm -r var/generation





          share|improve this answer























          • Clearing the cache did the trick for me

            – Milan Simek
            Dec 5 '17 at 17:22


















          0














          Ок, this does not make any sense to me.



          In Vendor/Module/Controller/Adminhtml/ I have the fallowing controllers:



          Controller/Adminhtml/Double.php
          Controller/Adminhtml/Module/Index.php
          Controller/Adminhtml/Test/Test.php


          If I send anjax to :



          location.protocol + '//' + location.host+'/admin/module/module/index


          or



          location.protocol + '//' + location.host+'/admin/module/test/test


          they both succeed. If I send ajax to ajax to



          location.protocol + '//' + location.host+'/admin/module/double


          i get



          http://mydomain/admin/module/double?isAjax=true 404 (Forbidden)


          Wtf is this :) And what is error 404 Forbidden :) ?






          share|improve this answer
































            0














            I don't know how it is possible, but i had the same error and i fixed it adding



            /**
            * Array of actions which can be processed without secret key validation
            *
            * @var string[]
            */
            protected $_publicActions = ['test'];


            and it starts to work, but now it continues to work even if $_publicActions is removed or commented out.






            share|improve this answer






























              0














              I use Magento 2.3.0, when I try to upload product image, then I get this error.
              ?isAjax=true
              Anyboady can help me? please, look at this film:
              http://recordit.co/HAMC9xTV0R
              Regards






              share|improve this answer























              • This is not really an answer to the question.

                – HelgeB
                yesterday










              Your Answer








              StackExchange.ready(function()
              var channelOptions =
              tags: "".split(" "),
              id: "479"
              ;
              initTagRenderer("".split(" "), "".split(" "), channelOptions);

              StackExchange.using("externalEditor", function()
              // Have to fire editor after snippets, if snippets enabled
              if (StackExchange.settings.snippets.snippetsEnabled)
              StackExchange.using("snippets", function()
              createEditor();
              );

              else
              createEditor();

              );

              function createEditor()
              StackExchange.prepareEditor(
              heartbeatType: 'answer',
              autoActivateHeartbeat: false,
              convertImagesToLinks: false,
              noModals: true,
              showLowRepImageUploadWarning: true,
              reputationToPostImages: null,
              bindNavPrevention: true,
              postfix: "",
              imageUploader:
              brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
              contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
              allowUrls: true
              ,
              onDemand: true,
              discardSelector: ".discard-answer"
              ,immediatelyShowMarkdownHelp:true
              );



              );













              draft saved

              draft discarded


















              StackExchange.ready(
              function ()
              StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f103068%2fmagento2-ajax-fails-in-admin%23new-answer', 'question_page');

              );

              Post as a guest















              Required, but never shown

























              5 Answers
              5






              active

              oldest

              votes








              5 Answers
              5






              active

              oldest

              votes









              active

              oldest

              votes






              active

              oldest

              votes









              1














              you should make the call to location.protocol + '//' + location.host+'/admin/vendor/module/test'



              [EDIT]

              or try
              location.protocol + '//' + location.host+'/admin/module/test'






              share|improve this answer

























              • nope... didnt work, same thing - 404 forbidden

                – Lachezar Raychev
                Feb 23 '16 at 15:08











              • how does your etc/adminhtml/routes.xml file look like?

                – Marius
                Feb 23 '16 at 15:10











              • <?xml version="1.0"?> <config xmlns:xsi="w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:App/etc/routes.xsd"> <router id="admin"> <route id="module" frontName="module"> <module name="Vendor_Module" /> </route> </router> </config>

                – Lachezar Raychev
                Feb 23 '16 at 15:12












              • see my edit. If that does not work, I'm out of ideas.

                – Marius
                Feb 23 '16 at 15:15











              • sadly, it didn't ... :( 10x anyway the weirdest error though ... 404 Forbidden... I've never seen this before

                – Lachezar Raychev
                Feb 23 '16 at 15:19
















              1














              you should make the call to location.protocol + '//' + location.host+'/admin/vendor/module/test'



              [EDIT]

              or try
              location.protocol + '//' + location.host+'/admin/module/test'






              share|improve this answer

























              • nope... didnt work, same thing - 404 forbidden

                – Lachezar Raychev
                Feb 23 '16 at 15:08











              • how does your etc/adminhtml/routes.xml file look like?

                – Marius
                Feb 23 '16 at 15:10











              • <?xml version="1.0"?> <config xmlns:xsi="w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:App/etc/routes.xsd"> <router id="admin"> <route id="module" frontName="module"> <module name="Vendor_Module" /> </route> </router> </config>

                – Lachezar Raychev
                Feb 23 '16 at 15:12












              • see my edit. If that does not work, I'm out of ideas.

                – Marius
                Feb 23 '16 at 15:15











              • sadly, it didn't ... :( 10x anyway the weirdest error though ... 404 Forbidden... I've never seen this before

                – Lachezar Raychev
                Feb 23 '16 at 15:19














              1












              1








              1







              you should make the call to location.protocol + '//' + location.host+'/admin/vendor/module/test'



              [EDIT]

              or try
              location.protocol + '//' + location.host+'/admin/module/test'






              share|improve this answer















              you should make the call to location.protocol + '//' + location.host+'/admin/vendor/module/test'



              [EDIT]

              or try
              location.protocol + '//' + location.host+'/admin/module/test'







              share|improve this answer














              share|improve this answer



              share|improve this answer








              edited Feb 23 '16 at 15:15

























              answered Feb 23 '16 at 15:06









              MariusMarius

              167k28319685




              167k28319685












              • nope... didnt work, same thing - 404 forbidden

                – Lachezar Raychev
                Feb 23 '16 at 15:08











              • how does your etc/adminhtml/routes.xml file look like?

                – Marius
                Feb 23 '16 at 15:10











              • <?xml version="1.0"?> <config xmlns:xsi="w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:App/etc/routes.xsd"> <router id="admin"> <route id="module" frontName="module"> <module name="Vendor_Module" /> </route> </router> </config>

                – Lachezar Raychev
                Feb 23 '16 at 15:12












              • see my edit. If that does not work, I'm out of ideas.

                – Marius
                Feb 23 '16 at 15:15











              • sadly, it didn't ... :( 10x anyway the weirdest error though ... 404 Forbidden... I've never seen this before

                – Lachezar Raychev
                Feb 23 '16 at 15:19


















              • nope... didnt work, same thing - 404 forbidden

                – Lachezar Raychev
                Feb 23 '16 at 15:08











              • how does your etc/adminhtml/routes.xml file look like?

                – Marius
                Feb 23 '16 at 15:10











              • <?xml version="1.0"?> <config xmlns:xsi="w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:App/etc/routes.xsd"> <router id="admin"> <route id="module" frontName="module"> <module name="Vendor_Module" /> </route> </router> </config>

                – Lachezar Raychev
                Feb 23 '16 at 15:12












              • see my edit. If that does not work, I'm out of ideas.

                – Marius
                Feb 23 '16 at 15:15











              • sadly, it didn't ... :( 10x anyway the weirdest error though ... 404 Forbidden... I've never seen this before

                – Lachezar Raychev
                Feb 23 '16 at 15:19

















              nope... didnt work, same thing - 404 forbidden

              – Lachezar Raychev
              Feb 23 '16 at 15:08





              nope... didnt work, same thing - 404 forbidden

              – Lachezar Raychev
              Feb 23 '16 at 15:08













              how does your etc/adminhtml/routes.xml file look like?

              – Marius
              Feb 23 '16 at 15:10





              how does your etc/adminhtml/routes.xml file look like?

              – Marius
              Feb 23 '16 at 15:10













              <?xml version="1.0"?> <config xmlns:xsi="w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:App/etc/routes.xsd"> <router id="admin"> <route id="module" frontName="module"> <module name="Vendor_Module" /> </route> </router> </config>

              – Lachezar Raychev
              Feb 23 '16 at 15:12






              <?xml version="1.0"?> <config xmlns:xsi="w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:App/etc/routes.xsd"> <router id="admin"> <route id="module" frontName="module"> <module name="Vendor_Module" /> </route> </router> </config>

              – Lachezar Raychev
              Feb 23 '16 at 15:12














              see my edit. If that does not work, I'm out of ideas.

              – Marius
              Feb 23 '16 at 15:15





              see my edit. If that does not work, I'm out of ideas.

              – Marius
              Feb 23 '16 at 15:15













              sadly, it didn't ... :( 10x anyway the weirdest error though ... 404 Forbidden... I've never seen this before

              – Lachezar Raychev
              Feb 23 '16 at 15:19






              sadly, it didn't ... :( 10x anyway the weirdest error though ... 404 Forbidden... I've never seen this before

              – Lachezar Raychev
              Feb 23 '16 at 15:19














              2














              I had the same issue. The reason could be, that the formkey is invalid, because it is not added to the url.



              My advice:



              • Do not use location.protocol or something else like location.host

              • Instead let the url be generated by PHP and then pass it to javascript in phtml file or as a variable (for example in a function created by block).

              Creation in PHP (from block) is:



              $this->getUrl('frontname/myController', $params )


              where:




              • frontname is defined in your route-file etc/adminhtml/routes.xml,


              • $params are the post-parameters (can be an empty array).

              Also it can be a cache-problems:



              • Check if you have caches disabled

              • run the command: php bin/magento cache:clean

              • run the command: rm -r var/generation





              share|improve this answer























              • Clearing the cache did the trick for me

                – Milan Simek
                Dec 5 '17 at 17:22















              2














              I had the same issue. The reason could be, that the formkey is invalid, because it is not added to the url.



              My advice:



              • Do not use location.protocol or something else like location.host

              • Instead let the url be generated by PHP and then pass it to javascript in phtml file or as a variable (for example in a function created by block).

              Creation in PHP (from block) is:



              $this->getUrl('frontname/myController', $params )


              where:




              • frontname is defined in your route-file etc/adminhtml/routes.xml,


              • $params are the post-parameters (can be an empty array).

              Also it can be a cache-problems:



              • Check if you have caches disabled

              • run the command: php bin/magento cache:clean

              • run the command: rm -r var/generation





              share|improve this answer























              • Clearing the cache did the trick for me

                – Milan Simek
                Dec 5 '17 at 17:22













              2












              2








              2







              I had the same issue. The reason could be, that the formkey is invalid, because it is not added to the url.



              My advice:



              • Do not use location.protocol or something else like location.host

              • Instead let the url be generated by PHP and then pass it to javascript in phtml file or as a variable (for example in a function created by block).

              Creation in PHP (from block) is:



              $this->getUrl('frontname/myController', $params )


              where:




              • frontname is defined in your route-file etc/adminhtml/routes.xml,


              • $params are the post-parameters (can be an empty array).

              Also it can be a cache-problems:



              • Check if you have caches disabled

              • run the command: php bin/magento cache:clean

              • run the command: rm -r var/generation





              share|improve this answer













              I had the same issue. The reason could be, that the formkey is invalid, because it is not added to the url.



              My advice:



              • Do not use location.protocol or something else like location.host

              • Instead let the url be generated by PHP and then pass it to javascript in phtml file or as a variable (for example in a function created by block).

              Creation in PHP (from block) is:



              $this->getUrl('frontname/myController', $params )


              where:




              • frontname is defined in your route-file etc/adminhtml/routes.xml,


              • $params are the post-parameters (can be an empty array).

              Also it can be a cache-problems:



              • Check if you have caches disabled

              • run the command: php bin/magento cache:clean

              • run the command: rm -r var/generation






              share|improve this answer












              share|improve this answer



              share|improve this answer










              answered Jul 26 '16 at 10:30









              codigacodiga

              536




              536












              • Clearing the cache did the trick for me

                – Milan Simek
                Dec 5 '17 at 17:22

















              • Clearing the cache did the trick for me

                – Milan Simek
                Dec 5 '17 at 17:22
















              Clearing the cache did the trick for me

              – Milan Simek
              Dec 5 '17 at 17:22





              Clearing the cache did the trick for me

              – Milan Simek
              Dec 5 '17 at 17:22











              0














              Ок, this does not make any sense to me.



              In Vendor/Module/Controller/Adminhtml/ I have the fallowing controllers:



              Controller/Adminhtml/Double.php
              Controller/Adminhtml/Module/Index.php
              Controller/Adminhtml/Test/Test.php


              If I send anjax to :



              location.protocol + '//' + location.host+'/admin/module/module/index


              or



              location.protocol + '//' + location.host+'/admin/module/test/test


              they both succeed. If I send ajax to ajax to



              location.protocol + '//' + location.host+'/admin/module/double


              i get



              http://mydomain/admin/module/double?isAjax=true 404 (Forbidden)


              Wtf is this :) And what is error 404 Forbidden :) ?






              share|improve this answer





























                0














                Ок, this does not make any sense to me.



                In Vendor/Module/Controller/Adminhtml/ I have the fallowing controllers:



                Controller/Adminhtml/Double.php
                Controller/Adminhtml/Module/Index.php
                Controller/Adminhtml/Test/Test.php


                If I send anjax to :



                location.protocol + '//' + location.host+'/admin/module/module/index


                or



                location.protocol + '//' + location.host+'/admin/module/test/test


                they both succeed. If I send ajax to ajax to



                location.protocol + '//' + location.host+'/admin/module/double


                i get



                http://mydomain/admin/module/double?isAjax=true 404 (Forbidden)


                Wtf is this :) And what is error 404 Forbidden :) ?






                share|improve this answer



























                  0












                  0








                  0







                  Ок, this does not make any sense to me.



                  In Vendor/Module/Controller/Adminhtml/ I have the fallowing controllers:



                  Controller/Adminhtml/Double.php
                  Controller/Adminhtml/Module/Index.php
                  Controller/Adminhtml/Test/Test.php


                  If I send anjax to :



                  location.protocol + '//' + location.host+'/admin/module/module/index


                  or



                  location.protocol + '//' + location.host+'/admin/module/test/test


                  they both succeed. If I send ajax to ajax to



                  location.protocol + '//' + location.host+'/admin/module/double


                  i get



                  http://mydomain/admin/module/double?isAjax=true 404 (Forbidden)


                  Wtf is this :) And what is error 404 Forbidden :) ?






                  share|improve this answer















                  Ок, this does not make any sense to me.



                  In Vendor/Module/Controller/Adminhtml/ I have the fallowing controllers:



                  Controller/Adminhtml/Double.php
                  Controller/Adminhtml/Module/Index.php
                  Controller/Adminhtml/Test/Test.php


                  If I send anjax to :



                  location.protocol + '//' + location.host+'/admin/module/module/index


                  or



                  location.protocol + '//' + location.host+'/admin/module/test/test


                  they both succeed. If I send ajax to ajax to



                  location.protocol + '//' + location.host+'/admin/module/double


                  i get



                  http://mydomain/admin/module/double?isAjax=true 404 (Forbidden)


                  Wtf is this :) And what is error 404 Forbidden :) ?







                  share|improve this answer














                  share|improve this answer



                  share|improve this answer








                  edited Feb 23 '16 at 17:28

























                  answered Feb 23 '16 at 16:46









                  Lachezar RaychevLachezar Raychev

                  66731435




                  66731435





















                      0














                      I don't know how it is possible, but i had the same error and i fixed it adding



                      /**
                      * Array of actions which can be processed without secret key validation
                      *
                      * @var string[]
                      */
                      protected $_publicActions = ['test'];


                      and it starts to work, but now it continues to work even if $_publicActions is removed or commented out.






                      share|improve this answer



























                        0














                        I don't know how it is possible, but i had the same error and i fixed it adding



                        /**
                        * Array of actions which can be processed without secret key validation
                        *
                        * @var string[]
                        */
                        protected $_publicActions = ['test'];


                        and it starts to work, but now it continues to work even if $_publicActions is removed or commented out.






                        share|improve this answer

























                          0












                          0








                          0







                          I don't know how it is possible, but i had the same error and i fixed it adding



                          /**
                          * Array of actions which can be processed without secret key validation
                          *
                          * @var string[]
                          */
                          protected $_publicActions = ['test'];


                          and it starts to work, but now it continues to work even if $_publicActions is removed or commented out.






                          share|improve this answer













                          I don't know how it is possible, but i had the same error and i fixed it adding



                          /**
                          * Array of actions which can be processed without secret key validation
                          *
                          * @var string[]
                          */
                          protected $_publicActions = ['test'];


                          and it starts to work, but now it continues to work even if $_publicActions is removed or commented out.







                          share|improve this answer












                          share|improve this answer



                          share|improve this answer










                          answered Feb 20 '18 at 9:25









                          LucScuLucScu

                          1,3211130




                          1,3211130





















                              0














                              I use Magento 2.3.0, when I try to upload product image, then I get this error.
                              ?isAjax=true
                              Anyboady can help me? please, look at this film:
                              http://recordit.co/HAMC9xTV0R
                              Regards






                              share|improve this answer























                              • This is not really an answer to the question.

                                – HelgeB
                                yesterday















                              0














                              I use Magento 2.3.0, when I try to upload product image, then I get this error.
                              ?isAjax=true
                              Anyboady can help me? please, look at this film:
                              http://recordit.co/HAMC9xTV0R
                              Regards






                              share|improve this answer























                              • This is not really an answer to the question.

                                – HelgeB
                                yesterday













                              0












                              0








                              0







                              I use Magento 2.3.0, when I try to upload product image, then I get this error.
                              ?isAjax=true
                              Anyboady can help me? please, look at this film:
                              http://recordit.co/HAMC9xTV0R
                              Regards






                              share|improve this answer













                              I use Magento 2.3.0, when I try to upload product image, then I get this error.
                              ?isAjax=true
                              Anyboady can help me? please, look at this film:
                              http://recordit.co/HAMC9xTV0R
                              Regards







                              share|improve this answer












                              share|improve this answer



                              share|improve this answer










                              answered yesterday









                              Emil ShamlooEmil Shamloo

                              85




                              85












                              • This is not really an answer to the question.

                                – HelgeB
                                yesterday

















                              • This is not really an answer to the question.

                                – HelgeB
                                yesterday
















                              This is not really an answer to the question.

                              – HelgeB
                              yesterday





                              This is not really an answer to the question.

                              – HelgeB
                              yesterday

















                              draft saved

                              draft discarded
















































                              Thanks for contributing an answer to Magento Stack Exchange!


                              • Please be sure to answer the question. Provide details and share your research!

                              But avoid


                              • Asking for help, clarification, or responding to other answers.

                              • Making statements based on opinion; back them up with references or personal experience.

                              To learn more, see our tips on writing great answers.




                              draft saved


                              draft discarded














                              StackExchange.ready(
                              function ()
                              StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f103068%2fmagento2-ajax-fails-in-admin%23new-answer', 'question_page');

                              );

                              Post as a guest















                              Required, but never shown





















































                              Required, but never shown














                              Required, but never shown












                              Required, but never shown







                              Required, but never shown

































                              Required, but never shown














                              Required, but never shown












                              Required, but never shown







                              Required, but never shown







                              Popular posts from this blog

                              Sum ergo cogito? 1 nng

                              419 nièngy_Soadمي 19bal1.5o_g

                              Queiggey Chernihivv 9NnOo i Zw X QqKk LpB