title: Jquery post not keeping line breaks
body: <p>I have this javascript which posts data from various divs but I can't seem to get it to keep linebreaks. </p>
  
  <p>I think it has to do with the fact that I use .text() on the content i find, which probably doesn't keep line breaks at all. I tried with .html() but that make all text written on a new line embeded in divs for some reason.</p>
  
  <p>Code is as below:</p>
  
  <pre><code>&lt;script type="text/javascript"&gt;
  
  $(document).ready(function() {
  
      $("#actor_result").load('xml/actortoxml.php?owner=&lt;?php echo $_SESSION['username'] . "&amp;id=" . $_GET['id']; ?&gt;');
      $('#save_editable').click(function() {
          var name = $(document).find('#actorname').text();
          var current = $(document).find('#currenthealth').text();
          var max = $(document).find('#maxhealth').text();
          var effects = $(document).find('#actoreffects').text();
          var notes = $(document).find('#actornotes').text();
  
          $.ajax({
              url: 'actor_profile.php',
              type: 'POST',
              data: {
                  update: 'true',
                  actorid: &lt;?php echo $_GET['id']; ?&gt;,
                  actorname: name, currenthealth: current, maxhealth: max, actoreffects: effects, actornotes: notes
              },
              success : function() {
              // gets called when ajax request completes successfully
              $("#actor_result").hide().load('xml/actortoxml.php?owner=&lt;?php echo $_SESSION['username'] . "&amp;id=" . $_GET['id']; ?&gt;').fadeIn(500);     
              },
              error : function(err) {
                  // in case of error
                  console.log(err);
                  alert('error');
              }
          });
      });
  });
  &lt;/script&gt;
  </code></pre>
  
  <p>Edit, this is the generated html from the xml file:</p>
  
  <pre><code>&lt;div id="actor_result" style="display: block;"&gt;
      &lt;!--?xml version="1.0"?--&gt;
  
      &lt;div class="row-fluid row span6 offset3"&gt;
          &lt;div class="media well well-small"&gt;
              &lt;a class="pull-left" href="#"&gt;&lt;img class=
              "media-object img-circle circle128" src=
              "images/avatar/actor/Davius.png"&gt;&lt;/a&gt;
  
              &lt;div class="media-body page-header actor-profile"&gt;
                  &lt;div class="editable_name" contenteditable="true" id=
                  "actorname"&gt;
                      &lt;h4 class="media-heading"&gt;Davius&lt;/h4&gt;
                  &lt;/div&gt;&lt;small&gt;&lt;strong&gt;awarnhag's minion&lt;/strong&gt;&lt;/small&gt;
              &lt;/div&gt;&lt;strong&gt;Health:&lt;/strong&gt;
  
              &lt;div class="div_inline editable_hp" contenteditable="true" id=
              "currenthealth"&gt;
                  17
              &lt;/div&gt;/
  
              &lt;div class="div_inline editable_hp" contenteditable="true" id=
              "maxhealth"&gt;
                  20
              &lt;/div&gt;hp
          &lt;/div&gt;
  
          &lt;h5&gt;&lt;span class="label"&gt;Effects&lt;/span&gt;&lt;/h5&gt;
  
          &lt;div class="editable well well-small" contenteditable="true" id=
          "actoreffects"&gt;
              Mumblecore bushwick sed, nulla street art dolore delectus wolf
              american apparel artisan sriracha. Laboris seitan hoodie,
              freegan brooklyn letterpress adipisicing chambray mixtape id
              tofu organic butcher small batch. Art party carles readymade
              messenger bag williamsburg. Irony placeat sustainable, high
              life cillum yr sed vinyl pork belly messenger bag williamsburg
              VHS. Occaecat lo-fi readymade gluten-free 3 wolf moon. Ad tofu
              twee, blog nulla mumblecore gentrify brooklyn odio cliche
              selvage put a bird on it pork belly chillwave deserunt. Ea
              assumenda chillwave, keytar velit tumblr pour-over enim VHS
              mcsweeney's blog.aaaa
          &lt;/div&gt;
  
          &lt;h5&gt;&lt;span class="label"&gt;Notes&lt;/span&gt;&lt;/h5&gt;
  
          &lt;div class="editable well well-small" contenteditable="true" id=
          "actornotes"&gt;&lt;/div&gt;
      &lt;/div&gt;
  &lt;/div&gt;
  </code></pre>