3

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

2
  • POST semantics doesn't pass parameters on query string. so this question is somewhat confusing. 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? Commented Jul 8, 2010 at 15:21

3 Answers 3

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.

Sign up to request clarification or add additional context in comments.

2 Comments

Cool! I am deleting my answer then.
Ok i'm using it thank you so much.. And also thanks espacially Pablo Santa Cruz for interested in my problem.
0

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.

2 Comments

+1 I see no reason for a downvote here. Suggesting POST is perfectly reasonable and moreover a preferred solution.
@Anurag: I didn't downvote, but this isn't an answer to the question and it should be a comment. Moreover, even if the OP had taken this advice the problem still stands - POST data still needs URL encoding.
0
http://www.mywebsite.com/index.html?html_code=Hi%20everybodyWhats'up.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.