-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapprove.js
More file actions
63 lines (59 loc) · 1.92 KB
/
approve.js
File metadata and controls
63 lines (59 loc) · 1.92 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
var appa = document.getElementById("appa");
var appadmin = document.getElementById("appadmin");
var rmart = document.getElementById("rmart");
var main = document.getElementsByClassName("main1")[0];
var mode = 0;
var ch = 0;
appa.addEventListener("click", function() {
ch = 1;
var xmlhttp = new XMLHttpRequest();
xmlhttp.onreadystatechange = function() {
if(this.readyState == 4 && this.status == 200) {
main.innerHTML = main.innerHTML + this.responseText;
// main.style.background-image = none;
}
}
xmlhttp.open("GET","approve.php?ch="+ch+"&mode="+mode,true);
xmlhttp.send();
document.body.addEventListener('click', function(event) {
var xmlhttp = new XMLHttpRequest();
if(event.srcElement.id == 'boom') {
var id = prompt("Enter the id(ONLY ONE) of the article to be approved");
}
xmlhttp.open("GET","approve.php?id="+id,true);
xmlhttp.send();
})
})
appadmin.addEventListener("click", function() {
ch = 2;
var xmlhttp = new XMLHttpRequest();
xmlhttp.onreadystatechange = function() {
if(this.readyState == 4 && this.status == 200)
{
main.innerHTML = main.innerHTML + this.responseText;
// main.style.background-image = none;
}
xmlhttp.open("GET", "approve.php?ch="+ch, true);
xmlhttp.send();
}
})
rmart.addEventListener("click", function() {
ch = 3;
xmlhttp = new XMLHttpRequest();
xmlhttp.onreadystatechange = function() {
if(this.readyState == 4 && this.status == 200) {
main.innerHTML = main.innerHTML + this.responseText;
// main.style.background-image = none;
}
}
xmlhttp.open("GET", "approve.php?ch="+ch, true);
xmlhttp.send();
document.body.addEventListener('click', function(event) {
var xmlhttp = new XMLHttpRequest();
if(event.srcElement.id == 'boom') {
var id = prompt("Enter the id(ONLY ONE) of the article to be deleted");
}
xmlhttp.open("GET","approve.php?id="+id+"&ch="+ch,true);
xmlhttp.send();
})
})