ajaxSuccess(); } else { ajaxError(); } break; //When to approve suggestions //When to approve suggestions case "suggestionapproval": //Retreive the values $suggest_id = $_POST['suggestid']; $action = $_POST['suggest_action']; $suggest = new suggest($suggest_id); switch ($action) { case 0: //Reject the suggestion if (!$suggest->reject()) { trigger_error("Cannot reject suggestion. Error Executing query", E_USER_NOTICE); } else { //Pass the id of the suggest so that proper HTML element can be made disappear ajaxSuccess(array("suggestid" => $suggest_id)); } break; case 1: //Accept the suggestion if (!$suggest->approve()) { trigger_error("Cannot approved the Suggestion. Error Executing query", E_USER_NOTICE); } else { //Pass the id of the suggest so that proper HTML element can be made disappear ajaxSuccess(array("suggestid" => $suggest_id)); } break;