$('#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());
}
});
alert("test");
function a() {
window.location.href = "Login.aspx";
}
});
因爲我接受了答案,它轉到服務器端代碼驗證用戶和控制傳遞給「a」函數,但它不顯示login.aspx頁面...任何線索?Ajax調用不起作用
什麼不行,呼叫或重定向? – Spokey
它永遠不會調用驗證方法。 –