我试图创建自己的 POST 请求。这是我的功能:
function sendPost(o) {
    var h = new XMLHttpRequest();
    h.onreadystatechange = requestComplete;
    function requestComplete() {
        if ( h.readyState === 4 ) {
            if ( h.status === 200 ) {
                if ( o.done ) {
                    o.done(h.responseText);
                }
            } else {
                if ( o.fail ) {
                    o.fail(h.responseText);
                }
            }
        }
    }
    h.open('POST', o.url, true);
    h.setRequestHeader('Content-type', 'application/x-www-form-urlencoded');
    h.send(o.data);
}
一切都很好,但我很困惑,如何将其 dataType 设置为script,就像在 jQuery 中一样:
$.ajax({
    url: 'someurl.php',
    type: 'POST',
    dataType: 'script' // <-- how to do this?
});