send HTML content in post request using javascript - Stack Overflow

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

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.

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.

Share Improve this question asked Jun 14, 2013 at 9:20 krishnakrishna 8372 gold badges11 silver badges19 bronze badges 1
  • try to store in textarea – Ivan Chernykh Commented Jun 14, 2013 at 9:22
Add a ment  | 

1 Answer 1

Reset to default 5

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

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

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

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745423385a4627066.html

相关推荐

  • send HTML content in post request using javascript - Stack Overflow

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

    8小时前
    30

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信