blob: e2991684ad4477a124e8862941e1e02f9a7f3f59 (
plain)
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
|
function rs_init_object () {
var A;
try {
A=new ActiveXObject("Msxml2.XMLHTTP");
} catch (e) {
try {
A=new ActiveXObject("Microsoft.XMLHTTP");
} catch (oc) {
A=null;
}
}
if(!A && typeof XMLHttpRequest != "undefined")
A = new XMLHttpRequest();
if (!A)
alert("Can't create XMLHttpRequest object");
return A;
}
function send_xmlhttp (url,args,callback) {
args = args || [];
callback = callback || function (data) { return data };
var content = '';
for (var i = 0; i < args.length; i = i + 2) {
content = content + "&" + args[i] + "=" + escape(args[i+1]);
}
content = content.replace( /[+]/g, '%2B'); // fix unescaped plus signs
var xmlhttp = rs_init_object();
xmlhttp.open("POST", url, true);
xmlhttp.onreadystatechange = function() {
if (xmlhttp.readyState != 4)
return;
if (xmlhttp.status == 200) {
var data = xmlhttp.responseText;
callback(data);
}
};
xmlhttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
xmlhttp.send(content);
}
|