title: How to make an admin ajax call in prestashop 1.7.6
body: <p>I'm trying to make an ajax call in Prestashop Admin:</p>
  <p>I created a module without a config page. It just add a button in some backoffice page, I'm trying to make an ajax call to my module file without success.</p>
  <p>Making an ajax call in frontend is working (I added an ajax.php file in my modules/mymodule/controller/front/ directory), I tried to do the same thing for admin but it's not working at all.</p>
  <p>What I've done:</p>
  <ul>
  <li>loading the js file from <em>actionAdminControllerSetMedia</em> is ok</li>
  <li>adding this in the composer.json file:</li>
  </ul>
  <pre><code>    &quot;autoload&quot;: {
        &quot;psr-4&quot;: {
          &quot;MyModule\\Controller\\&quot;: &quot;controllers/admin/&quot;
        },
        &quot;config&quot;: {
          &quot;prepend-autoloader&quot;: false
        },
  </code></pre>
  <ul>
  <li>created the <em>controllers/admin/ajax.php</em> file with this code (based on <a href="https://devdocs.prestashop.com/1.7/modules/concepts/controllers/admin-controllers/" rel="nofollow noreferrer">this documentation code</a>):</li>
  </ul>
  <pre><code>namespace MyModule\Controller;
  use PrestaShopBundle\Controller\Admin\FrameworkBundleAdminController;
  
  class DemoController extends FrameworkBundleAdminController
  {
      public $auth = false;
      public $ssl = true;
      public $ajax = true;
      public $errors = false;
      public $message;
  
      public function __construct()
      {
          parent::__construct();
      }
   
      public function initContent()
      {
          parent::initContent();
      }
      
      public function postProcess()
      {
          PrestaShopLogger::addLog(&quot;MODULE CONTROLLER OK &quot;, 1);
      }
  
      public function displayAjax()
      {
              $this-&gt;ajaxDie(json_encode(array('success'=&gt; !$this-&gt;errors, 'message' =&gt; $this-&gt;message)));
      }
  }
  </code></pre>
  <p>Then I tried to call the ajax from different way in js but never worked (the post query return is a message from prestashop &quot;page not found&quot; with http 200 response.</p>
  <p>the doc isn't very helpful and I only find old messages/ways to do (from Prestashop 1.7.5 I'd be able to create a custom Admin controller but it doesn't work), can someone explain me the steps to follow?</p>
  <p>thanks</p>