-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSearchByCustomer.js
99 lines (89 loc) · 3.15 KB
/
SearchByCustomer.js
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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
$(document).ready(function () {
$('#infoTable').on('click', 'tbody tr', function (event) {
$(this).addClass('highlight').siblings().removeClass('highlight');
console.log(this);
$("td", this).each(function (j) {
console.log(j);
});
});
$("#mm").click(function (event) {
$(".help-block").remove();
const formData = {
Fname: $("#Fname").val(),
Lname: $("#Lname").val(),
email: $("#email").val(),
phone: $("#phone").val(),
street: $("#street").val(),
city: $("#city").val(),
country: $("#country").val(),
};
console.log(formData);
$.ajax({
type: "POST",
url: 'SearchByCustomer.php',
data: formData,
dataType: "json",
encode: true,
})
.done(function (data) {
console.log(data);
var newdata = [];
newdata.push(data);
$('#infoTable').bootstrapTable({
toggle: true,
pagination: true,
striped: true,
pageSize: 10,
clickToSelect: true,
columns: [{
field: 'id',
title: 'Customer ID',
sortable: true
}, {
field: 'fn',
title: 'First Name'
}, {
field: 'ln',
title: 'Last Name'
}, {
field: 'ci',
title: 'Plate ID'
}, {
field: 'm',
title: 'model'
}, {
field: 'pd',
title: 'pay_date'
}, {
field: 'tp',
title: 'Payment'
}
],
data: data
});
})
.fail(function (jqXHR, exception) {
console.log("Fail");
// Our error logic here
var msg = '';
if (jqXHR.status === 0) {
msg = 'Not connect.\n Verify Network.';
} else if (jqXHR.status == 404) {
msg = 'Requested page not found. [404]';
} else if (jqXHR.status == 500) {
msg = 'Internal Server Error [500].';
} else if (exception === 'parsererror') {
msg = 'Requested JSON parse failed.';
} else if (exception === 'timeout') {
msg = 'Time out error.';
} else if (exception === 'abort') {
msg = 'Ajax request aborted.';
} else {
msg = 'Uncaught Error.\n' + jqXHR.responseText;
}
alert(msg);
$('#post').html(msg);
});
event.preventDefault();
});
});