Unfortunately, I'm getting nothing but jQuery results it seems. I'm looking for the correct way to pass parameters via AJAX, old browser fallbacks are not necessary, but no libraries, please. If there's another thread I've missed on this, please link =)
I'm using $, but it's a custom object/whatever, not jQuery.
$.ajax({
't':'POST',
'u':e,
'd':{ajax:'1'},
's':function(data){
console.log(data.response);
document.getElementById('mainc').innerHTML = data.response;
},
'e':function(data){
console.log(data);
}
});
Which calls:
$.ajax = function(a){
if(!a.u){return false;};
a.t=a.t||"GET";
typeof a.a=='undefined'?true:a.a;
a.e=a.e||function(){return false;};
a.s=a.s||function(){return true;};
var x=new XMLHttpRequest();
x.open(a.t,a.u,a.a);
x.onreadystatechange=function(){
if(x.readyState===4){
if(x.status===200){
a.s(x);
}else{
a.e(x);
}
}
};
a.t==="post" ? x.setRequestHeader("Content-Type", "application/x-www-form-urlencoded") : null;
x.send(a.d);
}
x.send(a.d)
should pass the {ajax:'1'}
. I've tried {'ajax':'1'}
and just 'ajax=1'
as well. Not sure why NONE of the parameters I try to pass are making it server side. I'm very certain the parameters are not hitting the server, although the request seems to otherwise send and receive without issue.