Added default Ajax action part 2
This commit is contained in:
@ -16,23 +16,21 @@
|
|||||||
*/
|
*/
|
||||||
abstract class AjaxAction extends Action
|
abstract class AjaxAction extends Action
|
||||||
{
|
{
|
||||||
public $template_dir = 'ajax';
|
|
||||||
public $data = 1;
|
public $data = 1;
|
||||||
protected $encode = true;
|
protected $encode = true;
|
||||||
|
|
||||||
function __construct()
|
function __construct()
|
||||||
{
|
{
|
||||||
Env::setParam('hide_debug', true);
|
|
||||||
|
|
||||||
parent::__construct();
|
parent::__construct();
|
||||||
|
|
||||||
$this->template = 'ajax';
|
$this->template = 'ajax';
|
||||||
}
|
}
|
||||||
|
|
||||||
function prepare()
|
function fetch()
|
||||||
{
|
{
|
||||||
|
// header("Content-type: application/json; charset=utf-8");
|
||||||
header("Content-type: text/html; charset=utf-8");
|
header("Content-type: text/html; charset=utf-8");
|
||||||
header("Cache-Control: no-store, no-cache, must-revalidate");
|
header("Cache-Control: no-store, no-cache, must-revalidate");
|
||||||
$this->templater->assign('data', $this->encode ? json_encode($this->data) : $this->data);
|
$this->view->assign('data', $this->encode ? json_encode($this->data) : $this->data);
|
||||||
|
return $this->view->fetch($this->getTemplate());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user