Hi everyone!
I'm trying to make a "posting" system and I wanted to incorporate jQuery into it so that it's more smooth an the page doesn't have to refresh. However I ran into some problems with it. When the user types a line break in the text area, the jQuery returns "n" instead of a line break. How the system works is that I send the "post" to a PHP that processes it and adds it to the database and if it is successful it will print out HTML that the "post" is in. The printed HTML is then returned to the jQuery file to be prepended onto a <div> in the main PHP page. I tried adding an nl2br on the PHP that processes the post but that didn't seem to work. Any ideas?
Here's the code:
JQuery:
function submit_post(){
var post = $('#textarea').val();
$.('post', { post: post } function(result){
if(result == /*some number*/){
//return an error
}
else{
$('#divname').prepend(result);
}
});
}

PHP processing post:
//code for processing it
$post = nl2br(stripslashes($post));
//prints out html
echo $post;
//ends html


Although it looks right to me, i'm not sure what I'm doing wrong or if there are any other solutions to this problem.
Thanks for everything!