How to disable render view in zend framework 2?

前端 未结 6 659
臣服心动
臣服心动 2021-01-30 09:39

I want to use some ajax, but I don\'t know how to use function as the same as setNoRender() in zend framework 2 to disable for render view.

How to disable rendering v

6条回答
  •  没有蜡笔的小新
    2021-01-30 10:12

    Proper and simple solution to do this

    public function testAction()
    {
        $data = array(
            'result' => true,
            'data' => array()
        );
        return $this->getResponse()->setContent(Json::encode($data));
    }
    

    Details: http://cmyker.blogspot.com/2012/11/zend-framework-2-ajax-return-json.html

提交回复
热议问题