Freemarker将String插入Javascript代码中

时间:2016-07-11 10:44:46

标签: freemarker

我想知道如何将字符串插入javascript代码中,如下例所示:

     <script type="application/ld+json">
        {
          "@context": "http://schema.org",
          "@type": "Restaurant",
          "name": "Dave's Steak House",
          "address": {
            "@type": "PostalAddress",
            "streetAddress": "148 W 51st St",
            "addressLocality": "New York",
            "addressRegion": "NY",
            "postalCode": "10019",
            "addressCountry": "US"
          }
        }
        </script>

问题在于,当我尝试在js之间插入字符串时,它似乎被解释为带有%&20等的HTML代码。我尝试使用?html,{{1} },escapeno escape?string等。

那是字符串:

?js_string,

代码:

$ {}的myString

0 个答案:

没有答案