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/borrowbook.html

71 lines
2.2 KiB
HTML
Raw Permalink Normal View History

2017-12-08 22:37:18 +08:00
<!DOCTYPE>
<html>
<head>
<title>BookSystem 图书借阅</title>
{{Header}}
{{navcss}}
</head>
<body>
{{nav}}
<div>
<p>确认借阅: 【<span id="book_name">正在获取图书信息</span>】 么?</p>
<button id="b_confirm" hidden>确定</button>
<button id="b_cancel" hidden>取消</button>
</div>
<script>
$("button").button();
function goBack() {
history.back();
location.reload(true);
}
var bid=GetRequest()["bid"];
console.log("BID is ",bid);
if(isNaN(parseInt(bid))){
console.log("Cannot Parse.");
GoBack();
}
mustLogin();
/// Fetch Info
$.post("/cgi-bin/booksys/doGetBookByObj",{bid:bid},function(data){
console.log("POST OK");
if(data.success==1) {
console.log("Result OK");
$("#book_name").text(data.book_name);
} else {
console.log("Result Failed.");
$("#book_name").text("无法获取图书名称,请刷新重试");
}
},"json").fail(function(err){
console.log("POST Failed");
$("#book_name").text("无法获取图书名称,请刷新重试");
});
$("#b_cancel").click(function(){
console.log("Operation Cancelled.");
goBack();
});
$("#b_confirm").click(function(){
console.log("Operation Confirmed");
$.post("/cgi-bin/booksys/doBorrowBook",{bid:bid},function(data){
console.log("Post OK");
if(data.success==1) {
location.href="borrow-success.html";
} else {
console.log("Failed.");
}
},"json").fail(function(err){
console.log("Post Failed");
});
});
</script>
</body>
</html>