-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrequest.js
59 lines (46 loc) · 1.63 KB
/
request.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
var requestGenerator = {
currentRequests: function (f) {
$.ajax({
url: 'http://localhost/api/temps',
type: 'GET',
dataType: 'json',
success: function (data) {
f(data);
},
error: function (x, y, z) {
alert(x + '\n' + y + '\n' + z);
}
});
},
writeRequestResponse: function (requests) {
var strResult = "<table class='table table-hover'><thead><tr><th>Code</th><th>Problem</th><th>Business Unit</th><th>Department</th><th>Status</th><th>Actions</th></tr></thead>";
$.each(requests.temp, function (index, r) {
strResult += "<tr><td>" + r.requestCode + "</td><td> " + r.problem + "</td><td>" + r.businessUnit + "</td><td>" + r.department + "</td><td>" + r.status + "</td><td>X</td></tr>";
});
strResult += "</table>";
$("#divResult").html(strResult);
},
showRequest: function () {
},
};
// Run our kitten generation script as soon as the document's DOM is ready.
document.addEventListener('DOMContentLoaded', function () {
requestGenerator.currentRequests(requestGenerator.writeRequestResponse);
});
function test() {
chrome.storage.sync.get('total', function (items) {
var newTotal = 0;
if (items.total) {
newTotal += parseInt(items.total);
}
var amount = $("#amount").val();
if (amount) {
newTotal += parseInt(amount);
}
chrome.storage.sync.set({ 'total': newTotal });
$('#total').text(newTotal);
$('#amount').val('');
});
}
$(function () {
});