If this is your first visit, be sure to
check out the FAQ by clicking the
link above. You may have to register or Login
before you can post: click the register link above to proceed. To start viewing messages,
select the forum that you want to visit from the selection below.

Hybrid View

AJAX post, how to encode?

Hello everybody,

I guess my main question is; How do i encode HTML data from a textarea to prepare it for an AJAX call ( post method ).

I'm trying to insert some html code in a record in my database via a ajax http request. I'm using the POST method. The html that i'm trying to insert is in a textarea ( CKEDITOR: WYSIWYG ) and it seems to be working. But when i change some mark-up in the textarea, like making a word Strong. The AJAX functions returns a 403 Forbidden page.
I don't understand this because there are also <p></p> surrounding the data but that doesn't give an error. Only if i change to mark-up some more and add more HTML to the data then the AJAX call gives the 403 response page.

What is the best way to solve this problem. Must i encode all data before the AJAX call?.
This is my code.