timu
timu

Reputation: 838

How to pass HTML code in query string

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.

Info : Im using GET Method

Upvotes: 3

Views: 11257

Answers (3)

Andy E
Andy E

Reputation: 344783

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

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

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.

Upvotes: 8

JohnB
JohnB

Reputation: 19012

http://www.mywebsite.com/index.html?html_code=Hi%20everybodyWhats'up.

Upvotes: 0

David Radcliffe
David Radcliffe

Reputation: 1491

What method are you using - GET or POST? You should be using POST. That will allow you to send full html and you don't need to use the querystring.

Upvotes: 0

Related Questions