forked from Xinyi-Lai/CS411_Geniuses
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathoperations.js
More file actions
executable file
·85 lines (77 loc) · 2.17 KB
/
operations.js
File metadata and controls
executable file
·85 lines (77 loc) · 2.17 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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
var xmlHttp
function delete_post(id, table) {
// Get xmlHttpObject object,if null,then the browser doesn't suppport ajax
xmlHttp = GetXmlHttpObject();
if (xmlHttp == null) {
alert ("Browser does not support HTTP Request");
return false;
}
// Get url
var url = "op_delete.php";
url = url + "?id=" + id;
url = url + "&table=" + table;
url = url + "&sid=" + Math.random();
// Set the callback function
xmlHttp.onreadystatechange=refreshPage;
//open
xmlHttp.open("GET",url,true)
xmlHttp.send(null)
return false
}
function approve_sale(id) {
// Get xmlHttpObject object,if null,then the browser doesn't suppport ajax
xmlHttp = GetXmlHttpObject();
if (xmlHttp == null) {
alert ("Browser does not support HTTP Request");
return false;
}
// Get url
var url = "op_approve.php";
url = url + "?id=" + id;
url = url + "&sid=" + Math.random();
// Set the callback function
xmlHttp.onreadystatechange=refreshPage;
//open
xmlHttp.open("GET",url,true)
xmlHttp.send(null)
return false
}
function reject_sale(id) {
// Get xmlHttpObject object,if null,then the browser doesn't suppport ajax
xmlHttp = GetXmlHttpObject();
if (xmlHttp == null) {
alert ("Browser does not support HTTP Request");
return false;
}
// Get url
var url = "op_reject.php";
url = url + "?id=" + id;
url = url + "&sid=" + Math.random();
// Set the callback function
xmlHttp.onreadystatechange=refreshPage;
//open
xmlHttp.open("GET",url,true)
xmlHttp.send(null)
return false
}
// Refresh page
function refreshPage() {
// Some delay to wait for the database to be ready
var t = setTimeout("location.reload()",100);
}
// Get xmlHttp object
function GetXmlHttpObject() {
var xmlHttp=null;
try {
// Firefox, Opera 8.0+, Safari
xmlHttp=new XMLHttpRequest();
} catch (e) {
// Internet Explorer
try {
xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
} catch (e) {
xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
}
}
return xmlHttp;
}