没有jQuery加载文本文件

I need to load the content of textfiles with Ajax - and I can't use Libraries like JQuery.

Everything is working fine, I receive the file and can work with its content. - In except of a javascript-warning in the Firefox-Console: "not well formed".

It seems that Firefox thinks I requested XML-content, which I didn't. So Firefox starts its XML-Parser and recognises that its not well-formed, noticeable with the warning in the console.

Here's the Ajax-Code I'm using:

function ajax(url, postData, callback) {
    var req = new XMLHttpRequest();
    req.open("GET",url,true);
     if (postData){
        req.setRequestHeader('Content-type','application/x-www-form-urlencoded');
    }
    req.onreadystatechange = function () {
        if (req.readyState != 4) return;
        if (req.status != 200 && req.status != 304) {
            return;
        }
        callback(req.response);
    }
    if (req.readyState == 4) return;
    req.send(postData);
}

What do I have to change, to tell Firefox that I just want a simple textfile (UTF8-encoded), and that it shouldn't parse it?

(Notice that Chrome doesn't print a Warning)

Use overrideMimeType to let the XMLHttpRequest know that it does not need to parse the file into an XML document

req.overrideMimeType("text/plain; charset=utf-8")