Jump to content

[SOLVED] Prestashop 1.7 ajax from tpl


2of7

Recommended Posts

Hi,

I'm trying to call a php file (from tpl file) with ajax but I always get a not found.
I have to go wrong with the friendly URLs.

In my hook tpl file I've

{literal}
<SCRIPT type="text/javascript">
function setGroup() {
	$.ajax({
		url: 'modules/advancedregistration/ajax-call.php',
		type: 'GET',
		data: 'ajax=true&clientgroups='+ $("#clientgroups").val(),
		cache: false,
		success: function(data) {
			console.log('success');
		}
	});
		return false;
	}
</SCRIPT>
{/literal}

and them in my-ajax.php

<?php
include_once('../../config/config.inc.php');
include_once('../../init.php');

public function get_group(){
	if(Tools::getValue('ajax')){
................

In Chrome console I see the link with parameters but the code is always 404.

So, what am I doing wrong in this url? Thank you

Edited by 2of7 (see edit history)
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...