When deleting an answer, blank page with JSON?
When deleting an answer, blank page with JSON?
Hi Guys.
When i delete an answer or unpublish an answer, it completes the task successfully but redirects me to a blank page with a JSON output on it, rather than the previous page with an alert...
Any ideas what is causing this?
When i delete an answer or unpublish an answer, it completes the task successfully but redirects me to a blank page with a JSON output on it, rather than the previous page with an alert...
{"error":"Item is deleted."}
function deleteAnswer(){
$user = &JFactory::getUser();
$answer_id = JRequest::getVar('id',0,'','INT');
if(!CAuthorization::authorise('answers.manage')){
echo json_encode(array('error'=>JText::_('NOT_AUTHORIZED')));
}else{
if(!$answer_id){
echo json_encode(array('error'=>JText::_('MSG_DELETE_FAIL')));
}else{
$model = &$this->getModel('answers');
if($model->deleteAnswer($answer_id)){
$this->setRedirect(JRoute::_('index.php?option='.APP_NAME.'&view=answers'.$itemid, false), JText::_('MSG_DELETE_SUCCESS'));
echo json_encode(array('data'=>JText::_('MSG_DELETE_SUCCESS')));
}else{
echo json_encode(array('error'=>JText::_('MSG_DELETE_FAIL')));
}
}
}
jexit();
}
Any ideas what is causing this?
Access to viewing replies is restricted.
Showing 6 of 6 replies
You do not have permissions for replying to this topic.