PHP function addslashes allows me to escape single quotes, newlines, etc. The problem is that I can't make an actual new line in the alert box. I tried replacing backslash n by double backslash n but it will display literaly "\n" in my alert box.
<?php $this->info = "Hello ' world\nNew line"; ?>
<script type="text/javascript">
$(document).ready(function() {
alert('<?php echo addslashes($this->info); ?>');
});
</script>