2of7 Posted October 5, 2018 Share Posted October 5, 2018 (edited) 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 October 6, 2018 by 2of7 (see edit history) Link to comment Share on other sites More sharing options...
2of7 Posted October 6, 2018 Author Share Posted October 6, 2018 (edited) I solved. This is the correct way to get the url: {$link->getModuleLink('mymodule', 'ajax', array())} Edited October 6, 2018 by 2of7 (see edit history) Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now