The message variable does not exist in the function. The object is a list of variables sent to the server, the function after it is the function run when the response comes. The message variable does not exist in that function.
I'm not sure what you are trying to do. If you are trying to replace the text before you send it to the server, then you need to use the following code:
$.post("insertPrivateMessage?action=sendchat",
{ to: GroupUserArray[count],
message: message.replace(/</g,"<").replace(/>/g,">").replace(/\"/g,"""),
username: $("#author").val(),
GROUP: chatboxtitle
} ,
function(data){
});
If you are trying to replace the data returned by the server, then you need to use this code:
$.post("insertPrivateMessage?action=sendchat",
{ to: GroupUserArray[count],
message: message,
username: $("#author").val(),
GROUP: chatboxtitle
} ,
function(data){
message = data.replace(/</g,"<").replace(/>/g,">").replace(/\"/g,""");
});