JavaScript html 解码
当我在asp.net应用程序中通过ajax接收html文本时,它看起来像:
<span%20style='color:green;font-weight:bold'>%20Text%20Msg</span>
javascript如何将该文本解码为普通html?
<span style='color:green;font-weight:bold'> Text Msg </span>
谢谢!
When I receive html text by ajax in asp.net application it looks like:
<span%20style='color:green;font-weight:bold'>%20Text%20Msg</span>
how is it possible in javascript decode that text to normal html?
<span style='color:green;font-weight:bold'> Text Msg </span>
Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
这里有一个很好的函数,可以为您做到这一点 - http://phpjs.org/functions/htmlspecialchars_decode:427
Nice function here that does it for you - http://phpjs.org/functions/htmlspecialchars_decode:427
您可能最适合寻找评论中已经提到的服务器端解决方案,因为这似乎是服务器端问题。
如果您出于某种原因希望无论如何都执行此客户端操作,这里有一个解决方案:
You are probably best suited with finding a server side solution as already mentioned in the comments, since this seems like a server side problem.
If you for some reason wish to do this client side anyway, here is a solution: