Read a text data from MySQL and pay it to JS variables such
CopyCodeThe Code is as follows: <SCRIPT type = "text/JavaScript"> var STRs = "surun grape plantation relies on two major transportation corridors: huining Expressway and yangxiao expressway, which are close to Xue Cun, Shangdang town, zhenrong Road, only 20 kilometers away from Zhenjiang City, the transportation is convenient. New varieties are introduced in surun grape plantation,
New processes, new technologies, and modern management systems are planted in greenhouses. Currently, there are five main varieties:,, huangmi, and golden finger. Surun grape plantation also ...";
Document. Write (STRs); </SCRIPT>
However, Firefox always reports the unterminated string literal error. Copy the text to the TXT file and several black blocks are displayed. It turns out to be the MySQL line feed mark \ r \ n. In the TXT file, it cannot be correctly displayed due to dual-byte usage, therefore, two black boxes are displayed.
Solution: Remove \ r \ n when the server returns this data.
$ Value = str_replace ("\ r \ n", "", $ value)