-
Notifications
You must be signed in to change notification settings - Fork 0
/
partsListTable.asp
151 lines (109 loc) · 4.94 KB
/
partsListTable.asp
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
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
<!DOCTYPE html>
<html>
<head>
<title>Parts Details </title>
<!--Include Bootstrap CSS-->
<!-- <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css"
crossorigin="anonymous"> -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script src="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/js/bootstrap.min.js"></script>
<!-- <link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap.min.css"> -->
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-EVSTQN3/azprG1Anm3QDgpJLIm9Nao0Yz1ztcQTwFspd3yD65VohhpuuCOmLASjC" crossorigin="anonymous">
<!-- <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.6.0/jquery.min.js" integrity="sha512-894YE6QWD5I59HgZOGReFYm4dnWc1Qt5NtvYSaNcOP+u1T9qYdvdihz0PPSiiqn/+/3e7Jo4EaG7TubfWGUrMQ==" crossorigin="anonymous" referrerpolicy="no-referrer"></script> -->
</head>
<body>
<!--#include file ="Admin/navbar.asp"-->
<!-- <Select id="dropdown">
<option value="">Select..</option>
</Select> -->
<h3 style="margin-left:35%">Company Own Parts</h3>
<table class="table table-condensed table-hovered table-striped" id="tableBody">
<thead>
<tr>
<th>Parts Name</th>
<th>Price</th>
<th>Quantity</th>
<!-- <th>Supplier Name</th> -->
</tr>
</thead>
<tbody>
</tbody>
</table>
</body>
<script>
$(document).ready(function () {
//jQuery on button click Call
// $('#btn').click(function () {
$('#tableBody tbody').empty(); // Clear the table body.
//ajax call to load XML and parse it
var myData;
$.ajax({
type: 'GET',
url: 'http://localhost/project/partsListXml.asp', // The file path.
dataType: 'xml',
success: function (xml) {
//find all book tags, loop them and append to table body
$(xml).find('part').each(function () {
myData = xml;
// Append new data to the tbody element.
$('#tableBody tbody').append(
'<tr>' +
'<td>' +
$(this).find('name').text() + '</td> ' +
'<td>' +
$(this).find('price').text() + '</td> ' +
'<td>' +
$(this).find('quantity').text() + '</td> ' +
'<td>' +
// $(this).find('supplier_name').text() + '</td> ' +
'</tr>'
);
// $('#dropdown').append(
// '<option value=' + $(this).find('customerid').text() + ' >' + $(this).find('name').text() + '</option> '
// );
});
}
});
// $("#dropdown").change(
// function () {
// console.log(this.value)
// $('#tableBody tbody').empty();
// $.ajax({
// type: "POST",
// url: "receieve.asp",
// dataType: "xml",
// data:{
// customerid: this.value
// },
// success: function (xml) {
// $(xml).find('customer').each(function () {
// $('#tableBody tbody').append(
// '<tr>' +
// '<td>' +
// $(this).find('customerid').text() + '</td> ' +
// '<td>' +
// $(this).find('name').text() + '</td> ' +
// '<td>' +
// $(this).find('country').text() + '</td> ' +
// '<td>'
// );
// });
// }
// })
// console.log(typeof s)
// // $('#tableBody tbody').append(
// // '<tr>' +
// // '<td>' +
// // s.find('customerid').text() + '</td> ' +
// // '<td>' +
// // s.find('name').text() + '</td> ' +
// // '<td>' +
// // s.find('country').text() + '</td> ' +
// // '<td>'
// // );
// }
// );
});
</script>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/js/bootstrap.bundle.min.js" integrity="sha384-MrcW6ZMFYlzcLA8Nl+NtUVF0sA7MsXsP1UyJoMp4YLEuNSfAP+JcXn/tWtIaxVXM" crossorigin="anonymous"></script>
</html>