I have something like this :
code.js
var params = {
option1 : encodeURIComponent("text\n text\n text\n\n\n"),
option2 : encodeURIComponent("\n\n\n text")
};
$.getJSON("/update_user_info", params, function(data) {});
/update_user_info
<?php
foreach($_GET as &$data) $data=urldecode($data);
/*CODE*/
echo json_encode($some_result);
?>
But my \n are removed or replaced with whitespaces
is it possible to keep newlines in GET request?
P.S: I have to make full ajax website, so I can’t use forms with regular “POST” method, submit buttons and so on.
Use nl2br to convert your newlines to HTML breaks