Merge branch 'm20_MDL-26176_cleanup' of github.com:danmarsden/moodle
[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))
aedbddfd 27 //popupwin(url+"\n"+param);
9633a423 28 httpReq.open("POST", url,false);
29 httpReq.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
0f995ab2 30 httpReq.send(param);
1daed920 31 if (httpReq.status == 200) {
aedbddfd 32 //popupwin(url+"\n"+param+"\n"+httpReq.responseText);
9633a423 33 return httpReq.responseText;
1daed920 34 } else {
9633a423 35 return httpReq.status;
1daed920 36 }
a5463b34 37}
38
aedbddfd 39function popupwin(content) {
15d2f0ca 40 var op = window.open();
a5463b34 41 op.document.open('text/plain');
42 op.document.write(content);
43 op.document.close();
aedbddfd 44}
45//-->