zend框架每個(gè)action會(huì)自動(dòng)跳轉(zhuǎn)到對(duì)應(yīng)的view和layouts中,要想使用ajax就必須先要禁用掉跳轉(zhuǎn)。
前端ajax照樣寫(xiě),后端的寫(xiě)法
$this->_helper->layout()->disableLayout(); //禁用布局的跳轉(zhuǎn)
$this->_helper->viewRenderer->setNoRender(true); //禁用路由的跳轉(zhuǎn)
數(shù)據(jù)返回
$return = array(
'result'=>-1,
'msg'=>'非法數(shù)據(jù)'
);
echo json_encode($result);

[專注待辦](https://itunes.apple.com/cn/app/zhuan-zhu-dai-ban-ding-shi/id1103227570?mt=8)