如果我想为日历创建可用性,我该怎么办?意味着,在用户之后,点击他们可以知道日期是否可用的日期。现在,我的代码在用户点击它时起作用,表格将会出现。希望你们能帮助我。
<body>
<!-- /.navbar-collapse -->
</div>
<!-- /.container -->
</nav>
<!-- Page Content -->
<div class="container">
<div class="row">
<div class="col-lg-12 text-center">
<img src="img/h3.png" alt="header">
<div id="calendar" class="col-centered">
</div>
</div>
</div>
<!-- /.row -->
<!-- Modal -->
<div class="modal fade" id="ModalAdd" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
<div class="modal-dialog" role="document">
<div class="modal-content">
<form class="form-horizontal" method="POST" action="addEvent.php">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
<h4 class="modal-title" id="myModalLabel">Car rental form</h4>
</div>
<div class="modal-body">
<div class="form-group">
<label for="title" class="col-sm-2 control-label">Title</label>
<div class="col-sm-10">
<input type="text" name="title" class="form-control" id="title" placeholder="Title">
</div>
</div>
<div class="form-group">
<label for="color" class="col-sm-2 control-label">Color</label>
<div class="col-sm-10">
<select name="color" class="form-control" id="color">
<option value="">Choose</option>
<option style="color:#0071c5;" value="#0071c5">◼ Dark blue</option>
<option style="color:#40E0D0;" value="#40E0D0">◼ Turquoise</option>
<option style="color:#008000;" value="#008000">◼ Green</option>
<option style="color:#FFD700;" value="#FFD700">◼ Yellow</option>
<option style="color:#FF8C00;" value="#FF8C00">◼ Orange</option>
<option style="color:#FF0000;" value="#FF0000">◼ Red</option>
<option style="color:#000;" value="#000">◼ Black</option>
</select>
</div>
</div>
<div class="form-group">
<label for="start" class="col-sm-2 control-label">Start date</label>
<div class="col-sm-10">
<input type="text" name="start" class="form-control" id="start" >
</div>
</div>
<div class="form-group">
<label for="end" class="col-sm-2 control-label">End date</label>
<div class="col-sm-10">
<input type="text" name="end" class="form-control" id="end" >
</div>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
<button type="submit" class="btn btn-primary">Save changes</button>
</div>
</form>
</div>
</div>
</div>
<!-- Modal -->
<div class="modal fade" id="ModalEdit" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
<div class="modal-dialog" role="document">
<div class="modal-content">
<form class="form-horizontal" method="POST" action="editEventTitle.php">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
<h4 class="modal-title" id="myModalLabel">Edit Event</h4>
</div>
<div class="modal-body">
<div class="form-group">
<label for="title" class="col-sm-2 control-label">Title</label>
<div class="col-sm-10">
<input type="text" name="title" class="form-control" id="title" placeholder="Title">
</div>
</div>
<div class="form-group">
<label for="color" class="col-sm-2 control-label">Color</label>
<div class="col-sm-10">
<select name="color" class="form-control" id="color">
<option value="">Choose</option>
<option style="color:#0071c5;" value="#0071c5">◼ Dark blue</option>
<option style="color:#40E0D0;" value="#40E0D0">◼ Turquoise</option>
<option style="color:#008000;" value="#008000">◼ Green</option>
<option style="color:#FFD700;" value="#FFD700">◼ Yellow</option>
<option style="color:#FF8C00;" value="#FF8C00">◼ Orange</option>
<option style="color:#FF0000;" value="#FF0000">◼ Red</option>
<option style="color:#000;" value="#000">◼ Black</option>
</select>
</div>
答案 0 :(得分:0)
据我所知,您想查看所选日期的可用性! 因此,您需要四个操作:
这是你实现你想要的目标。
TIPS: 1.
$(document).ready(function({
$('#start').on('change', function({
var your_start_date_value = $('#start').val();
});
});
更多信息,请阅读文档:http://api.jquery.com/val/
初始化一个ajax请求,您可以使用:Ajax或$ .post(这是一个ajax请求)
$.post( "phpfunction/url", { date: "your_start_date_value"} ,function( response) {
$( ".result" ).html( response); // display results
});
对于ajax请求,请阅读更多内容:http://api.jquery.com/jquery.ajax/
如果您有任何疑问,请回复我的评论!