-
Notifications
You must be signed in to change notification settings - Fork 0
/
http.js
34 lines (30 loc) · 973 Bytes
/
http.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
function httpGet(theUrl)
{
var xmlHttp = new XMLHttpRequest();
xmlHttp.open( "GET", theUrl, false ); // false for synchronous request
xmlHttp.send( null );
return xmlHttp.responseText;
}
function httpPost(theUrl,theData)
{
var xmlHttp = new XMLHttpRequest();
xmlHttp.open("POST",theUrl,false); // false for synchronous request
xmlHttp.send(theData);
return xmlHttp.responseText;
}
function httpGet2(theUrl,header,value)
{
var xmlHttp = new XMLHttpRequest();
xmlHttp.open( "GET", theUrl, false ); // false for synchronous request
xmlHttp.setRequestHeader(header,value);
xmlHttp.send( null );
return xmlHttp.responseText;
}
function httpPost2(theUrl,theData,header,value)
{
var xmlHttp = new XMLHttpRequest();
xmlHttp.open("POST",theUrl,false); // false for synchronous request
xmlHttp.setRequestHeader(header,value);
xmlHttp.send(theData);
return xmlHttp.responseText;
}