-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathparser.js
More file actions
27 lines (25 loc) · 809 Bytes
/
parser.js
File metadata and controls
27 lines (25 loc) · 809 Bytes
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
(function() {
var _this = this;
this.addEventListener('message', function(e) {
var temp, xml;
_this.response = new Object();
temp = e.data.id;
xml = new XMLHttpRequest();
xml.open(e.data.type, e.data.url, true);
xml.onreadystatechange = function() {
if (xml.readyState === 4) {
if (xml.status === 200) {
_this.response.error = false;
_this.response.response = eval('(' + xml.responseText + ')');
_this.response.id = temp;
return _this.postMessage(_this.response);
} else {
_this.response.error = true;
_this.response.response = xml.statusText;
return _this.postMessage(_this.response);
}
}
};
return xml.send(e.data.data ? e.data.data : null);
});
}).call(this);