簡體   English   中英

如何使用mysql的javascript提取格式顯示數據?

[英]how to display data in format using javascript extract from mysql?

這是我從數據庫中提取數據以及“異常”出現時要在視圖中呈現數據的原因,我想在新行中顯示。 但是我想以適當的方式在單行中顯示它們

The requirements of this chapter apply to the following: (1) New buildings or portions thereof used as health care occupancies (see 1.4.1) (2) Additions made to, or used as, a health care occupancy (see 4.6.6 and 18.1.1.4) Exception: The requirement of 18.1.1.1.1 shall not apply to additions classified as occupancies other than health care that are separated from the health care occupancy in accordance with 18.1.2.1(2) and conform to the requirements for the specific occupancy in accordance with Chapters 12 through 17 and Chapters 20 through 42, as appropriate.(3) Alterations, modernizations, or renovations of existing health care occupancies (see 4.6.7 and 18.1.1.4) (4) Existing buildings or portions thereof upon change of occupancy to a health care occupancy (see 4.6.11) Exception*: Facilities where the authority having jurisdiction has determined equivalent safety has been provided in accordance with Section 1.5.

我想按以下順序動態顯示

本章的要求適用於以下方面:

(1) New buildings or portions thereof used as health care occupancies (see 1.4.1)

 (2) Additions made to, or used as, a health care occupancy (see 4.6.6 and 18.1.1.4) 

Exception: The requirement of 18.1.1.1.1 shall not apply to additions classified as occupancies other than health care that are separated from the health care occupancy in accordance with 18.1.2.1(2) and conform to the requirements for the specific occupancy in accordance with Chapters 12 through 17 and Chapters 20 through 42, as appropriate.

(3) Alterations, modernizations, or renovations of existing health care occupancies (see 4.6.7 and 18.1.1.4) 

(4) Existing buildings or portions thereof upon change of occupancy to a health care occupancy (see 4.6.11) Exception*: Facilities where the authority having jurisdiction has determined equivalent safety has been provided in accordance with Section 1.5.

當我在javascript中執行此操作時。 我在section_data.title中獲得此內容的位置。 我該如何處理。

我覺得您的換行符不在html中。 嘗試使用str_replace('\\n', '<br>', $queryResultString); 在將其編碼為JSON之前將其寫入PHP(將$ queryResultString替換為您通過JSON發送的任何字符串)。

讓我知道這是否可行,或者我們可以嘗試其他方法。

使用JavaScript方法“ String [] split(String regex)”根據正則表達式拆分字符串並將其存儲在數組中。然后,您可以添加Breakline標簽對其進行格式化。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM