如何在jquery附加文本中保留空格和换行符

I am submitting textarea using ajax and when I append the response to a class it shows the dummy only when if there is no new line in text area .

HTML

   <p id="updateres_n"></p>
   <div class="update_res"></div>

ajax code

success: function(response){
     document.getElementById('upd_msg').innerHTML="updated";
     $('.update_res').append(response);
  }  

php code

First inserts textarea and print_r new updated text in javascript

<script>
 document.getElementById('updateres_n').innerHTML="<?php print_r (nl2br($updated_text));?>";
</script>

You can achieve it by css, use this and you're done...

.update_res {
    white-space: pre-wrap;
}

also give this css to the textarea also...