script.js
2.24 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
$(document).ready(function() {
$(".bookButton").click(function(){
pilot=$('#pilot').html();
flightID = $(this).attr("id")
$.ajax({
type: "POST",
url: "bookingHandler.php",
data: "pilot="+pilot+"&action=1&flight="+$(this).attr("id"),
success: function(html){
console.log(html)
if(html=='1') {
//$("#add_err").html("right username or password");
$("#"+flightID).attr("class", "btn");
$("#"+flightID).attr("disabled", "disabled");
$("#"+flightID).html("Booking Added");
}
else if(html=='2')
{
$("#"+flightID).attr("class", "btn btn-danger");
$("#"+flightID).attr("disabled", "disabled");
$("#"+flightID).html("Already Booked");
}
else {
$("#wrongPasswordMessage").css('display', 'inline-block', 'important');
$("#loadingMessage").css('display', 'none', 'important');
}
}
});
return false;
});
$(".removeBooking").bind('dblclick', function(){
var id = this.id;
$.ajax({
type: "POST",
url: "bookingHandler.php",
data: "id="+id+"&action=2&pilot="+$("#pilot").html(),
success: function(html){
console.log(html)
if(html=='1') {
//$("#add_err").html("right username or password");
$('#' + id + 'Block').remove();
}
}
});
});
$('.vaSelect').on('change', function() {
var values = this.value.split(".");
$.ajax({
type: "POST",
url: "updateVirtualAirline.php",
data: "va="+values[0]+"&flights="+values[1],
success: function(html){
console.log(html)
}
});
});
});