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 関数を追加しましたが、このボタンをクリックして確認メッセージが表示され、[OK] をクリックしても何も表示されませんか?