Didn't know how to formulate the question so feel free to change it if you want.
So what's wrong with my code?
(function() {
//--> DOM is ready
var _$ = {
g: function(u,c){ // c is callback function
x=new XMLHttpRequest();
x.onreadystatechange = function(c){ // same c isn't it?!
d="", e=null;
if (x.readyState==4) {
if (x.status==200) { d = x.responseText; }
else { e = x.statusText; }
c(e,d); // how come c is an object
// and not a function here?!
}
}
x.open("GET",u,true); x.send(null);
}
}
//--> Call our method:
_$.g("http://copy.com/K8UjOnVoyUCiNmPC/qcm/0/1/2.json",
function(e,d){
if(!e){
window.alert(d);
}
}
);
//--> .DOM
})();
Any clues what am I missing here? How to make it right?
Thanks!