I'm newbie of Zend. I'm trying to use ajax in Zend. Particularly, i want to do comment that using ajax. I have searched on google that i can use Zendx. I don't know how to use zendx effectively alth开发者_运维问答ough i have searched and tried implementing them . Thanks
I recommend using jQuery as it's just so quick and easy to use. As it's doing something like posting a comment you'd need to use this... http://api.jquery.com/jQuery.post/
From the Zend point of view. In your controller have an action like
public function commentpostAction()
{
$this->_helper->layout->disableLayout();
$this->_helper->viewRenderer->setNoRender(true);
// Add to database logic
// get post variables as you would do normally
$commentText = $this->getRequest()->getPost('commentText');
echo Zend_Json::encode( 'success' );
}
精彩评论