I’m using jQuery to output the results of a JSON string created by PHP from a database,
The only problem is that some of the data is on multiple lines… How would I get around this causing an unterminated string literal error in JavaScript?
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.
Escape line endings by replacing “\n” with “\\n” and “\r” with “\\r”. You will also want to escape single or double quotes, depending on which you are using to delimit the string.