I have this code wich works with no errors when sending "simple text" through Ajax post. But when i want to send "html" to the server, my code will fail sometimes.
var message = tinyMCE.activeEditor.getContent();
if(message.length > 0)
{
message = Base64.encode(message);
tinyMCE.activeEditor.setContent('');
var parameters = 'message=' + message;
var url = "ChatResponse.aspx";
ajaxPost.open("POST", url, true);
ajaxPost.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
ajaxPost.setRequestHeader("Content-Length", parameters.length);
ajaxPost.setRequestHeader("Connection", "close");
ajaxPost.send(parameters);
}
Will not fail for asdasdasdasd [base64:] YXNkYXNkPHN0cm9uZz5hc2Rhc2Q8L3N0cm9uZz4=
but will fail for
aa [base64:] YTxzdHJvbmc+YTwvc3Ryb25nPg==
What is wrong ?