Bry*_*eld 36 javascript ajax jquery content-type xmlhttprequest
我想看看标题是text/html还是text/xml.如果它是text/html那么就出现了错误,我宁愿在继续之前抓住它.
Que*_*tin 56
使用getResponseHeader()方法.
最小的例子:
<script>
function hand () {
console.log(this.getResponseHeader('content-type'));
}
var x = new XMLHttpRequest();
x.onreadystatechange = hand;
x.open('GET', 'index.html', true);
x.send();
</script>
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
35129 次 |
最近记录: |