如何在查询字符串中传递HTML代码 [英] How to pass HTML code in query string

查看:52
本文介绍了如何在查询字符串中传递HTML代码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要使用QueryString传递html代码,因为即时消息使用ajax方法在我的网站上发送帖子(我的意思是注释,而不是方法的类型).当我写这样的帖子时.

I need to pass html code with QueryString because im using ajax method to send post(i mean comment not the type of method) on my web site. When I write a post like that.

"Hi everybody<br />Whats'up."

只需嗨大家"就删除其余内容.

its just taking "Hi everybody" removing rest of the content.

信息:我正在使用GET方法

Info : Im using GET Method

推荐答案

不要使用 escape ,这是已弃用的函数.使用 encodeURIComponent 代替:

Don't use escape, it's a deprecated function. Use encodeURIComponent instead:

encodeURIComponent("Hi everybody<br />Whats'up.");

此外,请不要忘记地址栏中Internet Explorer的2,083个字符限制,如果要避免,应该使用POST而不是GET.

Also, don't forget about Internet Explorer's 2,083 character limit in the address bar, you should use POST instead of GET if you want to avoid it.

这篇关于如何在查询字符串中传递HTML代码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆