最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

send HTML content in post request using javascript - Stack Overflow

programmeradmin5浏览0评论

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

发布评论

评论列表(0)

  1. 暂无评论