0

I want to send a set of HTML contents using POST method in Ajax. It consists of some special characters When I retreive it using PHP, only half of the content is there.

This the example content which is used to post to the other Page. This post operation is performed by using the jQuery .post method.

Passed Content (via JS):

<div><label id="aboutDescription" style="">Firstline</label>&nbsp;</div>
<div><label id="about" style="">Secondline</label></div>

Retrieved Content (in PHP):

<div><label id="aboutDescription" style="">Firstline</label>

When I get using the $_REQUEST method I received only half of the contents.

I found the problem that whenever I get the " " or any other special characters the contents gets terminated. So I think I have to encode the content from javascript and decode the same content in PHP.

If I use encodeURIComponent in Javascript, how should I decode the contents in PHP? Is there any alternate functions which is equal to decodeURIComponent(Javascript Function) in PHP?

1 Answer 1

2

To decode the content using PHP, use this :

$decoded_string = urldecode('put encoded string here');
Sign up to request clarification or add additional context in comments.

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.