admin管理员组

文章数量:1290086

I need to pass html code with QueryString because im using ajax method to send post(i mean ment 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

I need to pass html code with QueryString because im using ajax method to send post(i mean ment 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

Share Improve this question edited Sep 22, 2012 at 12:35 timu asked Jul 8, 2010 at 14:54 timutimu 8387 gold badges20 silver badges41 bronze badges 2
  • POST semantics doesn't pass parameters on query string. so this question is somewhat confusing. – Scott Evernden Commented Jul 8, 2010 at 15:07
  • You can get some value back also with POST. The question to ask yourself when choosing between GET and POST is: does the query changes the state of the server? – dolmen Commented Jul 8, 2010 at 15:21
Add a ment  | 

3 Answers 3

Reset to default 8

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.

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.

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

本文标签: javascriptHow to pass HTML code in query stringStack Overflow