title: Prestashop 1.7 multiple ajax action functions in controller
body: <p>I have a javascript file and i have two ajax calls in it on different buttons. I have a controller, Auction.php, in which i have the functions for both actions ( showPopup and askBidControl ), but for the second function, the ajax returns 404 not found. It doesn't even enter the initContent function. Here is a sample of the code:</p>
  
  <pre><code> class askbidAuctionModuleFrontController extends ProductControllerCore {
  
      public function initContent(){
          $this-&gt;ajax = true;
          parent::initContent();
      }
  
      public function displayAjaxShowPopup(){
          $type = Tools::getValue('type');
          switch($type){
              case 'bid':
  
                  break;
              case 'ask':
  
                  break;
              default:
                  return false;
          }
          $product = $this-&gt;getTemplateVarProduct();
          ob_end_clean();
          header('Content-Type: application/json');
  
          $tpl = _PS_MODULE_DIR_.'askbid/views/templates/front/productPopUp.tpl';
          $this-&gt;context-&gt;smarty-&gt;assign('product', $product);
          $this-&gt;context-&gt;smarty-&gt;assign('type', $type);
          $html = $this-&gt;context-&gt;smarty-&gt;fetch($tpl);
          $this-&gt;ajaxDie(Tools::jsonEncode([
              'askbid_popup' =&gt; $html,
              'product' =&gt; $product,
          ]));
      }
  
      public function displayAjaxAskBidControl(){
          $type = Tools::getValue('type');
          $price = Tools::getValue('price');
          ob_end_clean();
          header('Content-Type: application/json');
          die('saracie');
  //        $this-&gt;ajaxDie(Tools::jsonEncode(['trafalet']));
      }
  
  }
  </code></pre>
  
  <p><br>
  The JS:</p>
  
  <pre><code>$(document).ready(function(){
      $('.askBidButton').on('click', function () {
          let buttons_container = $("#askbid_buttons");
          let data = {
              'action': 'showPopup',
              'id_product': buttons_container.data('id-product'),
              'id_product_attribute': buttons_container.data('id-product-attribute'),
              'type': $(this).val()
          };
          let url = buttons_container.data('popup-url');
          $.post(url, data, null, 'json').then(function (resp) {
              $('body').append(resp.askbid_popup);
              let productModal = $(`#bidask-modal-${resp.product.id}-${resp.product.id_product_attribute}`);
              productModal.modal('show');
              productConfig(productModal);
              productModal.on('hidden.bs.modal', function () {
                  productModal.remove();
              });
          }).fail((resp) =&gt; {
              prestashop.emit('handleError', {eventType: 'clickQuickView', resp: resp});
          });
          return false;
      });
      $('body').delegate('#continue_place_askbid', 'click', function(e){
         let type = $(this).val();
         let price = $(this).parent().find('#askbid_price_input').val();
         let data = {
             'action':'askBidControl',
             'type': type,
             'price': price
         };
         let url = $(this).closest('.quickview').data('popup-url');
         console.log(url);
         console.log('trafalet');
         $.ajax({
             url: url,
             data: data,
             success: function(resp){
                 console.log('trafaleteeeee');
             },
             error: function(err){
                 console.log(err);
             }
         });
         return false;
      });
  </code></pre>
  
  <p>productPopUp.tpl is in views/templates/front/</p>
  
  <p>I don't know exactly how to make the second ajax call work. It just gives 404 error.</p>
  
  <p>UPDATE: It seems it doesn't even go through initContent function of Auction.php on the second ajax request ( askBidController ) and it has 2 calls, one for the url i have in ajax, that returns 302 found, and another call to index.php?controller=404.</p>