Merge branch 'm20_MDL-26176_cleanup' of github.com:danmarsden/moodle
[moodle.git] / mod / scorm / request.js
... / ...
CommitLineData
1<!--
2function NewHttpReq() {
3 var httpReq = false;
4 if (typeof XMLHttpRequest != 'undefined') {
5 httpReq = new XMLHttpRequest();
6 } else {
7 try {
8 httpReq = new ActiveXObject("Msxml2.XMLHTTP.4.0");
9 } catch (e) {
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 }
20 }
21 return httpReq;
22}
23
24function DoRequest(httpReq,url,param) {
25
26 // httpReq.open (Method("get","post"), URL(string), Asyncronous(true,false))
27 //popupwin(url+"\n"+param);
28 httpReq.open("POST", url,false);
29 httpReq.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
30 httpReq.send(param);
31 if (httpReq.status == 200) {
32 //popupwin(url+"\n"+param+"\n"+httpReq.responseText);
33 return httpReq.responseText;
34 } else {
35 return httpReq.status;
36 }
37}
38
39function popupwin(content) {
40 var op = window.open();
41 op.document.open('text/plain');
42 op.document.write(content);
43 op.document.close();
44}
45//-->