prepare("DELETE FROM edu_learning_goals WHERE goal_code = :goal_code"); // 전달받은 학습목표코드를 바인딩하여 쿼리를 실행합니다. $stmt->execute([':goal_code' => $goal_code]); // Ajax 요청에 맞춰 JSON 응답을 반환합니다. header('Content-Type: application/json; charset=utf-8'); echo json_encode(['success' => true]); exit; } catch (PDOException $e) { // DB 쿼리 실행 중 에러가 발생하면 JSON 에러 응답을 반환합니다. header('Content-Type: application/json; charset=utf-8'); echo json_encode(['success' => false, 'message' => 'DB 오류: ' . $e->getMessage()]); exit; } } // 전달된 코드가 없는 경우 실패 응답을 반환합니다. header('Content-Type: application/json; charset=utf-8'); echo json_encode(['success' => false, 'message' => 'goal_code 가 없습니다.']); exit;