ты забыл подчёркнутое
window.onload = XmlHttp;
function XmlHttp(){
var name = newfolder;
xml = new XMLHttpRequest();
var params = 'name=' + encodeURIComponent(name);
xml.open("POST", 'post.php', true);
xml.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
*!*xml.setRequestHeader("Content-length", params.length);*/!*
xml.send(params);
}