4

I need to send a div element's inner HTML to server through post request.

What I tired using javascript is, Created a hidden input element and tried to assign the div's inner HTML in it and submitted it to the server. Since the inner HTML has single, double quotes it is not properly assigned to the value of input element.

Kindly suggest best solutions.

1
  • try to store in textarea Commented Jun 14, 2013 at 9:22

1 Answer 1

5

You can use urlencode(str) and urldecode(str) function or you can refer

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/encodeURIComponent?redirectlocale=en-US&redirectslug=JavaScript%2FReference%2FGlobal_Objects%2FencodeURIComponent

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/decodeURIComponent?redirectlocale=en-US&redirectslug=JavaScript%2FReference%2FGlobal_Objects%2FdecodeURIComponent

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.