Currently, I am facing an issue where I am losing some information while sending an ajax request to a servlet. The specific parameter that I am losing data from is the "comment" parameter. Below are the last 4 lines of my ajax code:
var params = "name=" + name + "&email=" + email + "&comment=" + comment + "&player_id=" + player_id;
xmlhttp.open("POST", 'comment', true);
xmlhttp.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
xmlhttp.send(params);
Before and after the send, when I alert my params, they appear as follows:
name=Chris&<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="3b5e565a5257065e565a52577b5c565a525715585456">[email protected]</a>&comment=Hey, check this song out on groovershark http://grooveshark.com/#!/s/Here+feat+Soulive/2YDJIw?src=5&player_id=4
However, in my servlet, when I print the comment parameter right after receiving it, the output is different:
Hey, check this song out on groovershark http://grooveshark.com/#!/s/Here feat Soulive/2YDJIw?src=5
The issue seems to be that the "+"
symbols are disappearing somewhere during the request from ajax to the container. I am unable to figure out why this is happening. I have identified this problem area after going through various steps and only noticed it all the way in the database connection with the assistance of another stack overflow user. If anyone can provide any insight on how to retain the "+"
characters, I would greatly appreciate it. Thank you!