I need to add a break in the javascript with the below situation.
<?php
$str_alert = "";
if(isset($case1)){
$str_alert .= "have case1 \n";
}
if(isset($case2)){
$str_alert .= "have case2 \n";
}
if(isset($case3)){
$str_alert .= "have case3 \n";
}
if(!empty($str_alert)){
?>
<script type="text/javascript" >
$(document).ready(function(){
alert("<?=$str_alert?>");
});
</script>
it break the javascript code and shows the error
SyntaxError: unterminated string literal
please give me any solution