Home > Web Front-end > JS Tutorial > The reason why mysql output data is assigned to js variable and unterminated string literal error occurs_javascript skills

The reason why mysql output data is assigned to js variable and unterminated string literal error occurs_javascript skills

WBOY
Release: 2016-05-16 18:26:36
Original
1958 people have browsed it

Read certain text data from mysql and pay it to js variables such as

Copy code The code is as follows:




But I found that the unterminated string literal error was always reported under Firefox. Copy that text to txt and open it. You will find several black squares. It turns out that they are mysql line break marks. n, in txt it cannot be displayed correctly because it uses double bytes, so 2 black squares are displayed.

Solution: When returning this data from the server, remove rn

$value=str_replace("rn","",$value)


Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template