开发者

Use Ajax in Zend

开发者 https://www.devze.com 2023-02-06 08:54 出处:网络
I\'m newbie of Zend. I\'m trying to use ajax in Zend. Particularly, i want to do comment that using ajax.

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' );
}
0

精彩评论

暂无评论...
验证码 换一张
取 消