Issue
I was trying to send below special character (!@#$%^&()++)(&^%$#@!!@#$%^&()++)(&^%$#@!!@#$%^&()++)(&^%$#@!!@#$%^&*()++) in the request url. It is a POST request. It is not allowing to send all the sepecial characher in the query string but It takes only first two special characters of the entry.
How can we send all the special character in the request url.
var reason = "!@#$%^&()++)(&^%$#@!!@#$%^&()++)(&^%$#@!!@#$%^&()++)(&^%$#@!!@#$%^&*()++";
var id = 123;
$http.post(serviceBaseUrl + 'abc/abc?id=' + id + '&reason=' + reason);
Request URL: http://localhost:8080/abc/abc/abc/abc?id=123&reason=!@
Kindly suggest me how to achive this.
Thank you
Solution
After some research, what it looks like you need to do is use the encodeURIComponent
method, so what you're code would be is
$http.post(serviceBaseUrl + 'abc/abc?id=' + id + '&reason=' + encodeURIComponent(reason));
Source: https://stackoverflow.com/a/13228872/10213537
Answered By - Ameer
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.