mysql_real_escape_string() -> stripslashes() -> jquery.append()
<p>im letting my users type in texts, then take them to server side php and process them, and if everything goes as it should, i just append the text with jquery without the page having to load all over again.</p>

<p>This is the procedure:</p>

<pre><code>$post_text = htmlspecialchars(mysql_real_escape_string($_POST['post_text']));
</code></pre>

<p>some logic...</p>

<p>everything ok!</p>

<pre><code>stripslashes(str_replace("\\n", "", $post_text))
</code></pre>

<p>and then i send all the nessesary data witj json</p>

<pre><code>echo json_encode($return); 
</code></pre>

<p>on the client side i append the html chunk saved in a variable from the server side.</p>

<p>this seems to work on localhost, it removes all the slashes and so on, but online it just doenst remove the slashes, and they keep coming up, when i hit refresh they dissapear becouse then its a </p>

<pre><code>stripslashes($comment['statusmsg_text'])
</code></pre>

<p>written out with php straight from the database. Is it the json that adds some extra stuff? i dont get it becouse it works perfectly on localhost.</p>

<p>best of regards,
alexander</p>
