<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>添加排片信息</title>
<script src="https://cdn.bootcdn.net/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
</head>
<body>
<form id="schedule-form">
<label for="hall">播放厅:</label>
<select name="hall" id="hall">
<option value="1">厅1</option>
<option value="2">厅2</option>
<option value="3">厅3</option>
</select>
<br>
<label for="time">上映时间:</label>
<input type="datetime-local" name="time" id="time">
<br>
<label for="period">上映时段:</label>
<select name="period" id="period">
<option value="morning">上午</option>
<option value="afternoon">下午</option>
<option value="evening">晚上</option>
</select>
<br>
<label for="price">影片价格:</label>
<input type="text" name="price" id="price">
<br>
<button type="submit">添加</button>
</form>
<script>
$(document).ready(function () {
// 异步校验
$("#period").blur(function () {
var hall = $("#hall").val();
var time = $("#time").val();
var period = $("#period").val();
if (hall &amp;&amp; time &amp;&amp; period) {
$.ajax({
url: "check_schedule.php",
method: "POST",
data: {
hall: hall,
time: time,
period: period
},
success: function (response) {
if (response === "valid") {
alert("当前厅的当前时间的当前时段可以排片");
} else {
alert("当前厅的当前时间的当前时段不可排片,请选择其他时间或时段");
}
}
});
}
});

// 提交表单
$("#schedule-form").submit(function (event) {
event.preventDefault();
var hall = $("#hall").val();
var time = $("#time").val();
var period = $("#period").val();
var price = $("#price").val();
if (hall &amp;&amp; time &amp;&amp; period &amp;&amp; price) {
// 执行添加排片的操作
$.ajax({
url: "add_schedule.php",
method: "POST",
data: {
hall: hall,
time: time,
period: period,
price: price
},
success: function (response) {
alert("排片信息添加成功");
// 清空表单
$("#schedule-form")[0].reset();
}
});
} else {
alert("请填写完整的排片信息");
}
});
});
</script>
</body>
</html>
电影排片管理系统 - 添加排片信息

原文地址: https://www.cveoy.top/t/topic/pSyz 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录