发送html字符串将单引号替换为双引号

时间:2018-07-05 22:14:33

标签: javascript html node.js express append

当我从包含一些动态填充的html的node.js服务器字符串中发送消息时,例如使用邮递员测试GET请求,我会得到正确的html:

<div class="page_wrapper_home">
    <div data-nanogallery2='{"itemsBaseURL": "../assets/galeria/", "thumbnailWidth": "auto", "thumbnailBorderVertical": 0, "thumbnailBorderHorizontal": 0, "colorScheme": { "thumbnail": { "background": "rgba(0,0,0,0)" } }, "thumbnailDisplayTransition": "flipDown", "thumbnailDisplayTransitionDuration": 750, "thumbnailDisplayInterval": 250, "thumbnailLabel": { "display": false }, "thumbnailHoverEffect2": "toolsAppear|scale120", "galleryDisplayMode": "pagination", "galleryPaginationMode": "numbers", "thumbnailAlignment": "center"}'>
        <a href="boda_01.jpg" data-ngthumb="boda_01_t.jpg" data-ngdesc="">boda_01</a>
        <a href="boda_02.jpg" data-ngthumb="boda_02_t.jpg" data-ngdesc="">boda_02</a>
        <a href="boda_03.png" data-ngthumb="boda_03_t.jpg" data-ngdesc="">boda_03</a>
        <a href="boda_05.jpg" data-ngthumb="boda_05_t.jpg" data-ngdesc="">boda_05</a>
        <a href="boda_06.jpg" data-ngthumb="boda_06_t.jpg" data-ngdesc="">boda_06</a>
        <a href="boda_04.jpg" data-ngthumb="boda_04_t.jpg" data-ngdesc="">boda_04</a>
        <a href="boda_07.jpg" data-ngthumb="boda_07_t.jpg" data-ngdesc="">boda_07</a>
        <a href="boda_08.jpg" data-ngthumb="boda_08_t.jpg" data-ngdesc="">boda_08</a>
        <a href="boda_09.jpg" data-ngthumb="boda_09_t.jpg" data-ngdesc="">boda_09</a>
    </div>
</div>

但是当我使用JQuery's append()方法,single quotes are subtituted by double quotesdouble quotes are substituted by &quot;时,因此在整个部分中只显示双引号。我该怎么做才能获得完全相同的标记?

0 个答案:

没有答案