Hi Razaro,
I try your response to Ruman but I don't see the value in in view...
I have:
- JS in root->modules->modulename->views->js->namejsfile.js
- CONTROLLER in root->modules->modulename->controllers->front->controllername.php
- VIEW in root->modules->modulename->views->templates->front->filename.tpl
in js file
$('#send').click(function(){
var ciao = 'cioaa';
var myUrl = prestashop.urls.base_url + 'index.php?fc=module&module=configuratore&controller=task';
$.ajax({
type: 'get',
cache:false,
url: myUrl,
data: {
ajax: true,
datas:ciao,
action: 'fromAjax',
},
})
.done(function() {
console.log('Success!');
})
.fail(function() {
console.log('error');
});
});
in php file
class ConfiguratoreTaskModuleFrontController extends ModuleFrontController
{
public function __construct()
{
parent::__construct();
}
public function init()
{
parent::init();
}
public function initContent()
{
parent::initContent();
$this->setTemplate('module:configuratore/views/templates/front/task.tpl');
}
$this->fromAjax();
}
public function fromAjax()
{
$mVar = Tools::getValue('datas');
return $this->context->smarty->assign(array('var'=>$mVar));
}
and in tpl
{$var}
in console log I receive success as a answer but I can't see in view?
What I'm doing wrong?