This repository has been archived on 2021-11-25. You can view files and clone it, but cannot push or open issues or pull requests.
DBHomework/web/booksys/removebook.html

102 lines
3.7 KiB
HTML
Raw Normal View History

2017-12-08 22:37:18 +08:00
<!DOCTYPE>
<html>
<head>
<title>BookSystem 删除图书信息</title>
{{Header}}
{{navcss}}
</head>
<body>
{{nav}}
<div id="info_panel"></div>
<div id="control_panel">
<p>删除图书信息</p>
<p>确认要删除【<span id="book_name">正在获取图书信息...</span>】么?</p>
<button id="b_confirm">确认</button>
<button id="b_cancel">取消</button>
</div>
<script>
$("#info_panel").hide(0).click(function(){
$("#info_panel").hide(100,function(){
$("#control_panel").show(100);
});
});
$("button").button();
mustLogin();
var id=GetRequest()["id"];
/// Check Permission
$.post("/cgi-bin/booksys/doCheckPermission",{required:2},function(data){
console.log("Permission Check Success");
if(data.success!=1) {
console.log("Permission Denied.");
location.href="mainpage.html";
} else {
console.log("Permission Check Pass");
}
},"json").fail(function(err){
console.log("Failed to check permission");
});
/// Fetch Book Data
$.post("/cgi-bin/booksys/doViewBook",{id:id},function(data){
console.log("Fetch Ajax Done.");
if(data.success==1) {
console.log("Success!");
$("#book_name").html("<b>"+data.book_name+"</b>");
} else {
console.log("Fetch Failed");
}
},"json").fail(function(err){
console.log("Fetch Ajax Error: ",err);
});
$("#b_cancel").click(function(){
console.log("Operation Cancelled");
$("#control_panel").hide(100,function(){
$("#info_panel").text("操作取消");
createHighlight($("#info_panel"));
$("#info_panel").show(100,function(){
GoBack();
});
});
});
$("#b_confirm").click(function(){
console.log("Operation Confirmed");
$.post("/cgi-bin/booksys/doRemoveBook",{id:id},function(data){
console.log("RemoveBook Ajax Success");
if(data.success==1) {
console.log("RemoveBook Success");
$("#control_panel").hide(100,function(){
$("#info_panel").text("删除成功!");
createHighlight($("#info_panel"));
$("#info_panel").show(100,function(){
GoBackWith(2);
});
});
} else {
console.log("RemoveBook Failed");
$("#control_panel").hide(100,function(){
$("#info_panel").text("操作失败(服务错误)");
createError($("#info_panel"));
$("#info_panel").show(100);
});
}
},"json").fail(function(err){
$("#control_panel").hide(100,function(){
$("#info_panel").text("操作失败(一般错误)");
createError($("#info_panel"));
$("#info_panel").show(100);
});
});
});
</script>
</body>
</html>