如何在Zend Framework 2中添加Ajax请求

How to execute ajax request in zend framework 2? I am beginner specially for zend framework 2. so i am not sure how to disabled layout... for my json response.

sounds like you want to execute ajax request in zf2.

 $viewModel = new ViewModel();

 $viewModel->setTerminal(true);
 return $viewModel;

Your ajax url must be like this baseurl+'/yourcontroller/ajax'

And in your ajax Action

public function ajaxAction()
{
      $this->_helper->layout->disableLayout();
      $this->_helper->viewRenderer->setNoRender(); //ajax dont wants a view

     //you can access your params like this

     echo $this->_helper->getParam('paramname');exit;

}