Use json_encode to escape confirm() messages