When posting from JS, PHP (5.3.8) returns some line returns in excess. For example:
if (isset($_POST['postId']) && $_POST['postId'] == "test") {
echo 'ok';
}
returns ok↵↵↵
Is this by design? How can I get rid of those line returns?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
No, this is not by design. You have three newline output.
Try to delete the close tag of php
?>, if you don’t have any html after php code.Another way is just put
exit;right afterecho, you won’t get newline again.