<input type="text" name="ARRIVE" ID="ARRIVE" size="10" value="$_POST[ARRIVECHK]" readonly />
<input type="text" name="DEPART" ID="DEPART" size="10" value="$_POST[DEPARTCHK]" readonly />
Code สำหรับบันทึกวันที่ ลงใน From
โดยเลือกวันที่ ARRIVE แล้วบันทึก ข้อมูล DEPART โดย วันที่ 1วัน
<script type="text/javascript">
$(function() {
$('#ARRIVE').datepicker({
dateFormat: 'dd/mm/yy',
showOn: "both",
minDate: 1,
numberOfMonths: 2,
changeMonth: true,
changeYear: true,
showButtonPanel: true,
onSelect: function(date)
{
date = $(this).datepicker('getDate');
date.setDate(date.getDate() 1);
$('#DEPART').val($.datepicker.formatDate('dd/mm/yy', date)
);
}});
});
$(function() {
$('#DEPART').datepicker({
minDate: 1,
dateFormat: 'dd/mm/yy',
showOn: "both",
numberOfMonths: 2,
changeMonth: true,
changeYear: true,
showButtonPanel: true
});
});
</script>
Code สำหรับส่งค่าไปค้นหา
ต้องการส่งข้อมูลถ้าข้อมูลของ #DEPART ไม่เท่ากับช่องว่าง
ตอนนี้ต้องมา เลือก#DEPART อีกครั้งถึงจะแสดง ห้องพักออกมา<script type="text/javascript">
$(document).ready(function(){
$("#DEPART").each(function() {
//$(this).click(function(){
$(this).change(function(e){
var $arrive_date=$('#ARRIVE').val();
var $depart_date=$('#DEPART').val();
var $hotel_code=$('#Hotel_Code').val();
var url="modules/reservation/roomlist.php?NewBooking";
var dataPost={
arrive_date: $arrive_date,
depart_date:$depart_date,
hotel_code: $hotel_code
}
$.post(url,dataPost,function(data){
//alert("บันทึกข้อมูลเรียบร้อย" data);
$("div#showRoomList").html(data); // ส่วนที่ 3 นำข้อมูลมาแสดง
});
});
});
});
</script>