I am using PHP with jquery.
I get textarea value by jquery command:
$('#textarea_id').val()
If i use spaces in textarea, like My Text , it only gets My.
If i use return key in my textarea like,
My
Text
It gets as MyText
EDIT:
It seems $('#textarea_id').val() works truly.
Actually, I am using a function call like
func1(...,$('#textarea_id').val(),...);
and in func1, i have:
function func1(...,textarea_content,...) {
$('#textarea_id').load('/test.php?textarea_content=' + textarea_content + ...);
}
and also in test.php i grab textarea_content with $textarea_content = $_REQUEST['textarea_content'];
If i use echo $textarea_content for viewing textarea content.
in case of MyText, it will be ok.
in case of My Text it will be null!.
and in case of
My
Text
it will be MyText
SOLUTION:
I found the solution in
Jquery .val() not returning line-breaks in a textarea
the solution is : encodeURIComponent($('#textarea_id').val())
Many thanks