酒店管理系统增删改查前端代码
时间: 2023-11-11 20:02:11 浏览: 39
酒店管理系统的前端代码会涉及到HTML、CSS、JavaScript等技术,这里给您提供一个简单的例子,供您参考:
HTML代码:
```html
<div class="form-group">
<label for="hotelName">酒店名称:</label>
<input type="text" class="form-control" id="hotelName" name="hotelName" required>
</div>
<div class="form-group">
<label for="hotelAddress">酒店地址:</label>
<input type="text" class="form-control" id="hotelAddress" name="hotelAddress" required>
</div>
<div class="form-group">
<label for="hotelPhone">酒店电话:</label>
<input type="text" class="form-control" id="hotelPhone" name="hotelPhone" required>
</div>
<button type="submit" class="btn btn-primary">提交</button>
```
这是一个添加酒店信息的HTML表单,通过输入酒店名称、地址和电话,点击提交按钮即可向后台发送请求。
JavaScript代码:
```javascript
// 添加酒店信息
function addHotel() {
var hotelName = $("#hotelName").val();
var hotelAddress = $("#hotelAddress").val();
var hotelPhone = $("#hotelPhone").val();
$.ajax({
type : "post",
dataType : "json",
url : "/hotel/add",
data : {
"hotelName" : hotelName,
"hotelAddress" : hotelAddress,
"hotelPhone" : hotelPhone
},
success : function(result) {
if (result.code == 200) {
// 添加成功,刷新页面
window.location.reload();
} else {
// 添加失败,显示错误信息
alert(result.message);
}
},
error : function() {
alert("系统错误,请稍后重试!");
}
});
}
```
这是一个添加酒店信息的JavaScript代码,通过使用jQuery的ajax方法向后台发送请求,然后根据返回结果进行相应的操作。
至于其他的增删改查代码,可以根据具体需求进行编写,这里不再赘述。