$.ajax({ timeout:10000,type : "post",dataType : "json",async : false,// 加上这一句就可以正常运行 url : "userAction_userLogin.action",data : { account : userAccount,pwd : password },success : function(response) { alert(response.string); window.navigate("jsp/device_management.jsp"); window.location.href="jsp/device_management.jsp" },error : function(xhr,textStatus,errMsg) { alert("登录失败! "+xhr+errMsg+textStatus); } });