Skip to content

Embed URL

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
XmlHttpRequest w/ compression support
// typical generic request routine (handles GET and POST)
function makeRequest(href, next, body, contentType) {
var ajax;
ajax=new XMLHttpRequest();
if(ajax) {
ajax.onreadystatechange = next();
if(body) {
ajax.open('post',href,false);
ajax.setRequestHeaders('content-type',contentType);
ajax.setRequestHeaders('accept-encoding','gzip');
ajax.send(body);
}
else {
ajax.open('get',href,false);
ajax.setRequestHeaders('accept-encoding','gzip');
ajax.send(null);
}
}
}
@shmert

Thanks Mamund, but it should be:

ajax.setRequestHeader('accept-encoding','gzip');

Also, I get this error from Chrome:

Refused to set unsafe header "accept-encoding"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.