function LogoutClick() { var r=confirm("确定退出吗?"); if (r==true) { $.ajax({ type: "GET", url: baseURL + "/api/logout", data: {}, success: function(data){ if (data.code ==0 ){ alert("退出成功!"); location.href = "index.html"; } } }); } else { // alert("You pressed Cancel!"); } }