title: Problem when retrieving text in JSON format containing line breaks with jQuery
body: <p>I'm having a strange problem when retrieving JSON formatted text. I use jQuery <code>post</code> to send some data (also JSON formatted) to the server (running PHP) which works fine. Then, when I request the same data from the server using jQuery <code>get</code>, the callback method never executes. This only occurs when the data is JSON formatted and the data contains a line break. When I don't use JSON formatting it works fine. What baffles me is that there are no problems with uploading the data.</p>
  
  <p>Uploading code: (works)</p>
  
  <pre><code>$.post("ajax/contents_ajax.php", {
      'title': caption,
      'text': frameText().getContent(),
      'image_id': img
  },
  //Callback
  </code></pre>
  
  <p>Download code: (doesn't work with line breaks)</p>
  
  <pre><code>$.get("ajax/contents_ajax.php", { 'get_item': id },
  function (data){
      //Never gets executed if data contains line breaks
  }
  ,'json');
  </code></pre>
  
  <p>The whole problem stems from the fact that the TinyMCE rich text editor seems to insist on inserting line breaks everywhere, even though I enabled the option</p>
  
  <pre><code>remove_linebreaks : true
  </code></pre>
  
  <p>I do prefer to have line breaks, but not if they break my code. Can anyone tell me what the problem is here, and perhaps how I can encode the linebreaks on the server with PHP?</p>
  
  <hr>
  
  <h2>Update</h2>
  
  <p>While the suggestions to replace <code>'\n'</code> with <code>''</code> did not work, it was close to the right solution. This code removed the offending characters:</p>
  
  <pre><code>function parse($text){
      $parsedText = str_replace(chr(10), "", $text);
      return str_replace(chr(13), "", $parsedText);
  
  }
  </code></pre>