作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我的代码很简单。
function useXMLHttpRequest() {
var xmlhttp = new XMLHttpRequest();
xmlhttp.open("POST", "test.ashx", false);
xmlhttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded;charset=UTF-8");
xmlhttp.onReadyStateChange = function () {
alert("ss");
};
xmlhttp.send("i=5");
alert(xmlhttp.responseText);
}
当我调用 useXMLHttpRequest.Yes 时,它会提醒 xmlhttp.responseText 的值。但它不警报(“ss”)。在 IE9 和 Firefox 中均如此。谁能告诉我穿的是什么?
最佳答案
JavaScript(以及我所知道的所有其他语言)区分大小写,因此 onreadystatechange
与onReadyStateChange
不同。
试试这个:
xmlhttp.onreadystatechange = function() {
alert("ss");
};
关于javascript - 我的 onReadyStateChange 从未被调用,为什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13081272/
背景 我最近在 merge 期间遇到了一个意外未 merge 的文档文件的问题。 无论出于何种原因,我搞砸了 merge 并有效地删除了文件(和其他几个文件),因为我忘记了它们的存在。 现在我想查看我
我在我的网站上使用旧的 mysql 版本和 php 版本 4。 我的表结构: | orders_status_history_id | orders_id | orders_status_id |
我是一名优秀的程序员,十分优秀!