I am creating a web app which uses jQuery to authenticate:
$.ajax({
url: "/session/create?format=json",
type: "GET",
dataType: "json",
cache: false,
username: $("#signin-email").val(),
password: $("#signin-password").val(),
success: function(data) {
if(data.success) {
success = true;
}
}
});
The problem is that the code only makes the AJAX-request when the username
does not include things like an @
(probably because the @ is a seperator for authentication and host in the URL), which is required in my app. Can anyone help me with how I can do this? I 开发者_运维百科do not mind changing the back-end a little bit, but requiring users to have an @
-less email is not an option.
Oh, my back-end is a Ruby-on-Rails app.
You should replace all @s with %40. The @ is namely teh seperator between the authentication and host in the URL (e.g. http://someone:password@example.com/
Couldn't replicate described behavior: request is being sent for @-logins. Are you sure that this is not a server problem (e.g. response isn't in json format)? (Btw, I'm using standard jquery, suppose there are no hacks for one that RoR shipped with)
精彩评论