我对 Zend Ajax 有一些问题。那是我的js代码:
function deleteNewsCategory(cId) {
var conf = confirm("Are you sure you want to delete the item?");
if(conf) {
$.ajax({
dataType: 'json',
url: '/ajax/deletenewscategory',
type: 'POST',
data: {
cId : cId
},
success: function (response) {
alert(response);
}
});
}
}
那是我的 AjaxController:
public function init() {
$this->_helper->ajaxContext->addActionContext('deletenewscategory', 'json')
->initContext();
}
public function deletenewscategoryAction() {
if ($this->getRequest()->isPost()) {
echo $this->_request->getPost('cId');
}
}
我在提交按钮中添加了 deleteNewsCategory 功能,但是当我单击此按钮并出现确认消息并单击确定时,我什么也没看到?