java - ajax - Why jquery replaces "+" with a space (" ")? -


I am having a problem here when I use Ajax to pass my parameter to a controller with a "+" I am changing it from some place. Example, I value = Tom + Jerry + Garfield ajax. When I use System.out.println () in my controller, it displays Tom Jerry Garfield . I tried to use other special characters, I have no problem.

Please help in advance thanks.

something in GET and POST URL is most likely or via form), the blank space is encoded in the form of "+" (plus) symbols before it gets to the server if you have a normal GET You can see this behavior if you request - you will see something like google.com?q=test+example if you want to pass through a plus symbol an Ajax GET / POST request, you need to "urlencode" it is the URL encoded value for + % 2B .

Also note:

JavaScript encodercomponent () function can be used, as answered:



Comments

Popular posts from this blog

java - NullPointerException for a 2d Array -

python - Assemble mpeg file unable to play in mediaplayer -

c# - NameSpace Manager or XsltContent to parse aspx page -