polished.
[moodle.git] / mod / scorm / request.js
CommitLineData
15d2f0ca 1<!--
2a0407b7 2function NewHttpReq() {
3 var httpReq = false;
15d2f0ca 4 if (typeof XMLHttpRequest != 'undefined') {
2a0407b7 5 httpReq = new XMLHttpRequest();
6 } else {
7 try {
5e5b6b7f 8 httpReq = new ActiveXObject("Msxml2.XMLHTTP.4.0");
2a0407b7 9 } catch (e) {
5e5b6b7f 10 try {
11 httpReq = new ActiveXObject("Msxml2.XMLHTTP");
12 } catch (ee) {
13 try {
14 httpReq = new ActiveXObject("Microsoft.XMLHTTP");
15 } catch (eee) {
16 httpReq = false;
17 }
18 }
19 }
2a0407b7 20 }
21 return httpReq;
22}
23
4928a2f3 24function DoRequest(httpReq,url,param) {
9633a423 25
2a0407b7 26 // httpReq.open (Method("get","post"), URL(string), Asyncronous(true,false))
9633a423 27
28 httpReq.open("POST", url,false);
29 httpReq.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
30 httpReq.send(param);
1daed920 31 if (httpReq.status == 200) {
9633a423 32 return httpReq.responseText;
1daed920 33 } else {
9633a423 34 return httpReq.status;
1daed920 35 }
a5463b34 36}
37
15d2f0ca 38/*function popupwin(content) {
39 var op = window.open();
a5463b34 40 op.document.open('text/plain');
41 op.document.write(content);
42 op.document.close();
15d2f0ca 43}*/
44//-->