0

I have written this code for authentication.It works well till calling of function "a", control goes to function a but it ignores redirect line..I checked using alert that it executes "a" function. Why this is happening?

 $('#loginbtn').click(function() {
var userName = document.getElementById('uid').value;
var password = document.getElementById('pwd').value;
$.ajax({
    type : "POST",
    url : "/LoginNew.aspx/Authenticate",
    data : { 
        userName: userName ,
        password: password 
    },
    async : false, 
    contentType : "application/json; charset=utf-8",
    dataType : "json",
    success : a, 
    error : function(e) {
        alert(e.valueOf());
    }
});

function a() {
    window.location.href = "Login.aspx";
}
});
user1093183
  • 23
  • 1
  • 5

2 Answers2

2
success : a() //function is called like this

try using

success : function(){window.location.href = "Login.aspx"};
Tushar Gupta - curioustushar
  • 58,085
  • 24
  • 103
  • 107
0

Remove .href part, and you need to specify a path, something like this

window.location = "/Login.aspx";
zs2020
  • 53,766
  • 29
  • 154
  • 219
  • @user1093183 that's weird. your code looks good and that is the only thing I can see. sorry. – zs2020 Aug 08 '13 at 06:55