function addAnswer($params) { $getdata = new getData(); $params['userid'] = $_SESSION["userid"]; $answer = $getdata->add_answer($params); header('Content-Type:application/json'); echo json_encode($answer); }