How to ajax request to custom page in prestashop 1.7

Viewed 10732

Am apology for my bad english. Am new to prestashop. Please anybody help. How to send AJAX request to custom php file in prestashop

//My js file
     $.ajax({
     url : baseUrl + "modules/<myModule>/ajaxfunc.php",
     type: "POST",
     cache: false,
     data : {form_data: 1 , action:'imageuploadAction'},

     beforeSend: function() {
     $('body').append('<div class="loading_popup">Loading...</div>');},        

    success: function(data){
    console.log(data);
       }
      });

// php file
// modules/<myModule>/ajaxfanc.php

   <?php
   include_once('../../config/config.inc.php');
   include_once('../../init.php');
   class ajaxfuncAjaxModuleFrontController extends ModuleFrontController
    {
    public function  imageuploadAction() {
     die('here');
    }
   }
   ?>

I didn't know its be correct or not. please guide me.

2 Answers
Related