Jump to content

Controller With Ajax


Recommended Posts

Hello,

 

I would appreciate any help on this. I am doing a module... and I need that after pressing some button DIV element would show different content (depending on the response).

 

This is my controllers code:

 

 

public function initContent()

{

 

 

if(!isset($_GET['oper'])) {

//parent::initContent();

$smarty = $this->context->smarty;

 

$tpl_vars['tips_optimization'] = $_SERVER['REQUEST_URI'];

$tpl_vars['postvar'] = $_GET['id'];

 

 

 

$export = new Export(Db::getInstance(), _DB_PREFIX_);

 

 

 

$tpl_vars['result'] = $export->getProductsExcel();

 

$smarty->assign($tpl_vars);

//$this->setTemplate('display.tpl');

}

elseif($_GET['oper'] == 'export') {

 

echo("test");

 

}

 

 

 

}

 

 

After pressing the button and sending the oper parameter with value "export" it responses me with the "Test" text and it packs it inside the template.

Is it possible to tell the initContent not to pack the response inside the template? I would like to receive only the plain text.

 

I ve attached already the printscreen how it looks now. This behaviour is not correct :( We see here administration panel with another administration panel included.

 

Thanks for any hits on this.

post-484870-0-79300700-1361229064_thumb.png

Link to comment
Share on other sites

×
×
  • Create New...