I made a little script that send a textarea content to PHP page with get ajax request:
$.get('./data/pages/admin/actions.php?savepost=1','&post_id=' + $(box).attr('id') + '&text=' + new_text,'text');
new_text get content from textarea with val();
When I save the text from php it has no \n character. Some1 can solve my problem? Thanks
You’re not encoding your data at all, so lots of things are going to blow up (percent signs, ampersands, …). Either use
encodeURIComponenton each bit or (and this is easier) let jQuery do it for you:See the docs for details on the data parameter.