-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathahahLib.js
executable file
·46 lines (37 loc) · 1.18 KB
/
ahahLib.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
function callAHAH(url, pageElement, callMessage, errorMessage, param, param2,param3,param4) {
if (callMessage)
document.getElementById(pageElement).innerHTML = callMessage;
try {
req = new XMLHttpRequest(); /* e.g. Firefox */
} catch(e) {
try {
req = new ActiveXObject("Msxml2.XMLHTTP"); /* some versions IE */
} catch (e) {
try {
req = new ActiveXObject("Microsoft.XMLHTTP"); /* some versions IE */
} catch (E) {
req = false;
}
}
}
req.onreadystatechange = function() {responseAHAH(pageElement, errorMessage, param, param2, param3);};
req.open("GET",url,true);
req.send(null);
}
function responseAHAH(pageElement, errorMessage, param, param2, param3) {
var output = '';
if(req.readyState == 4) {
if(req.status == 200) {
output = req.responseText;
if (pageElement == 'updateComments') {
document.getElementById(pageElement).innerHTML = output;
}
// (empty string)
if (pageElement == '') {
}
} else {
if (pageElement)
document.getElementById(pageElement).innerHTML = errorMessage + " (" + req.status + ")\n"+output;
}
}
}