开发者

Strings from JSON response not escaped correctly in HTML markup

开发者 https://www.devze.com 2023-02-28 06:52 出处:网络
I have a JSON response with strings escaped as follows: 24\" escaped as 24&#34 (no semicolon) When I write this string to markup with JQuery .text(), 开发者_开发技巧the final result appears as 24

I have a JSON response with strings escaped as follows: 24" escaped as 24&#34 (no semicolon)

When I write this string to markup with JQuery .text(), 开发者_开发技巧the final result appears as 24&#34 in the generated markup (the & in 24&#34 is HTML escaped).

Is there a good way to display this text correclty in the browser (i.e. 24" instead of 24&#34)?


try .html() instead of .text() and the data you are getting is coming from database?

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号