如果服务器返回的文档类型为"text/xml", 你的data.php页为text/html类型
所以你每次都得到这个结果var xmlhttp = new ActiveXObject("MSXML2.XMLHTTP.3.0");
xmlhttp.open("GET", "http://localhost/sample.xml", false);
xmlhttp.send();
alert(xmlhttp.getResponseHeader("content-type"));

解决方案 »

  1.   

    请注意我的问题,我问的是  data.php 文件的内容应该怎么写才会得到:text/javascript、text/xml
      

  2.   

    解决了,在google上面找了10分钟<?php
    header("Content-Type: text/javascript");
    ?>
    来者散分,限时10分钟。
      

  3.   

    header("Content-Type:text/xml");

    header("Content-type:text/xml;charset=gb2312");
      

  4.   

    问题:data.php里的内容分别为什么才会使 getResponseHeader("content-type") 返回的值为:
    Header函数