This is the string saved in the database:
~`@#$%^&*()_+}{":?><,./;'[]=-|\"
But it returns as:
~`@#$%^&*()_+}{":?><,./;'[]=-|\"
This is my AJAX function:
function 开发者_如何学PythongetComment(timesheetId,activityId,date,employeeId){
var r = $.ajax({
type: 'POST',
// contentType: " charset=utf-8",
url: linkToGetComment,
data: "timesheetId="+timesheetId+"&activityId="+activityId+"&date="+date+"&employeeId="+employeeId,
async: false,
success: function(comment){
cmnt= comment;
}
});
return cmnt;
}
Try calling:
unescape(YOUR_STRING);
The special characters are being html encoded at some point, so you need to unencode them.
http://www.w3schools.com/jsref/jsref_unescape.asp
Before un-escaping any string, you should really make sure your text is coming from a safe source and is not based on any user input.
That said, the unescape() function should work for you:
cmnt= unescape(comment);
精彩评论