$.ajax POST with special characters in URL

$.ajax POST with special characters in URL

Hi,

Good morning, good day and good evening.

We have a current program where I pass the username/password in the URL property of the $.ajax. However, if a user's password has #, * or % (and some other characters) on it i'm getting an error and the request won't reach the server.

So basically I'm passing something like this on the url: http://mysite/get/{username}/{password}

Is there a way jquery ajax call can accept these characters? I already used the encodeURIComponent function but this doesn't work.

NOTE: I know passing the usename/password in URL is not a good practice, I just want to know if there is a way in fixing this without changing the approach.

Thank you in advance.