I have following variable in php which is contains paragraph with line breaks. i need to put this $message
value in session and access the session in jquery.
Message from textarea
look likes:
$message = nl2br($_POST['message']);
$_SESSION['message'] = $message;
So when i access paragraph with line breaks it not working, but paragraph with out line breaks, it works. What the error here?
<script type="text/javascript">
$(document).ready(function () {
var subject = "<?php if(isset($_SESSION['subject'])){echo $_SESSION['subject'];} ?>"
alert(subject);
});
</script>