来自CMS页面的Prestashop Ajax

I need send data ajax from cms.tpl, but url no works. Display 404.

var formData = { 
    'referencia_producto': $('input[name=reference_product]').val(),
    'tipo_form': $('input[name=tipo_form]').val()
};

$.ajax({
    type: 'POST',
    headers: {"cache-control": "no-cache"},
    url:baseUri+'index.php?id_cms=18&controller=cms',
    data: formData,
    async: true,
    cache: false,
    dataType: 'json',
    success: function (data) {
    }
});

What is the way for implement AJAX from CMS?

Thank You

Mh the easiest way to my mind: create module where you could write your JS , CSS , PHP code and hook it to CMS.

Also, did you try this code in {literal} YOUR CODE {/literal} to use it in TPL File.