Search code examples
jqueryajaxasp.net-mvcjquery-pluginsfroala

Froala Editor: get content and post ajax request


I use

`$(".selector").editable("getHTML");`


Like document said to get content in HTML.

Example this is a content from method getHTML:

<p><b>Hello</b>, people</p>

Then I post ajax request to server to save the content, but the server doesn't response my request, if I change the content to:

`Hello, people`


by remove html tag, server response my request. So the problem come from I send message contain forbidden character.

How do I convert or wrap the content like submit form method does?


Solution

  • I try and it works:
    1. I use getHTML to get content in HTML format.
    2. Set text of textarea by the above content.
    3. Get encode html by calling .html() from textarea. $('#selector').html();

    Now I have string value will be accepted by server.