在IE下正常,在firefox下第一次打开返回空值,要刷新一下后就正常了
时间:2011-04-10
来源:互联网
             function showshi(data){
//alert('aadsf');
//XMLHttpReq.setRequestHeader("Content-Type","gb2312");
xmlhttp.open("GET","showcity.php?t="+Math.random()+"&sheng="+data,true);
xmlhttp.send(null);
document.getElementById('shi').innerHTML = process_request;//显示状态
xmlhttp.onreadystatechange=function(){
if (4==xmlhttp.readyState){
if (200==xmlhttp.status){
alert(xmlhttp.responseText);
//var responseTexts = xmlhttp.responseText;
//document.getElementById('shi').innerHTML=responseTexts;
}
else{
alert('sdfsdf');
}
}
}
}
在firefox下第一次打开页面alert(xmlhttp.responseText);是空;刷新一下后就每次都正常了;在IE 不存在这个问题,好奇怪,不知道原因,求救。。。。。。
            //alert('aadsf');
//XMLHttpReq.setRequestHeader("Content-Type","gb2312");
xmlhttp.open("GET","showcity.php?t="+Math.random()+"&sheng="+data,true);
xmlhttp.send(null);
document.getElementById('shi').innerHTML = process_request;//显示状态
xmlhttp.onreadystatechange=function(){
if (4==xmlhttp.readyState){
if (200==xmlhttp.status){
alert(xmlhttp.responseText);
//var responseTexts = xmlhttp.responseText;
//document.getElementById('shi').innerHTML=responseTexts;
}
else{
alert('sdfsdf');
}
}
}
}
在firefox下第一次打开页面alert(xmlhttp.responseText);是空;刷新一下后就每次都正常了;在IE 不存在这个问题,好奇怪,不知道原因,求救。。。。。。
作者: dqfxptom 发布时间: 2011-04-10
             是不是数据还没有加载完,你就对数据进行操作了?            
            作者: y_h_t 发布时间: 2011-04-11
             function showshi(data){
//alert('aadsf');
//XMLHttpReq.setRequestHeader("Content-Type","gb2312");
document.getElementById('shi').innerHTML = process_request;//显示状态
xmlhttp.onreadystatechange=function(){
if (4==xmlhttp.readyState){
if (200==xmlhttp.status){
alert(xmlhttp.responseText);
//var responseTexts = xmlhttp.responseText;
//document.getElementById('shi').innerHTML=responseTexts;
}
else{
alert('sdfsdf');
}
}
}
xmlhttp.open("GET","showcity.php?t="+Math.random()+"&sheng="+data,true);
xmlhttp.send(null);
}
回调函数要设置在上面。把顺序调整一下
            //alert('aadsf');
//XMLHttpReq.setRequestHeader("Content-Type","gb2312");
document.getElementById('shi').innerHTML = process_request;//显示状态
xmlhttp.onreadystatechange=function(){
if (4==xmlhttp.readyState){
if (200==xmlhttp.status){
alert(xmlhttp.responseText);
//var responseTexts = xmlhttp.responseText;
//document.getElementById('shi').innerHTML=responseTexts;
}
else{
alert('sdfsdf');
}
}
}
xmlhttp.open("GET","showcity.php?t="+Math.random()+"&sheng="+data,true);
xmlhttp.send(null);
}
回调函数要设置在上面。把顺序调整一下
作者: licip 发布时间: 2011-04-11
 相关阅读 更多  
      
    热门阅读
-   office 2019专业增强版最新2021版激活秘钥/序列号/激活码推荐 附激活工具 office 2019专业增强版最新2021版激活秘钥/序列号/激活码推荐 附激活工具阅读:74 
-   如何安装mysql8.0 如何安装mysql8.0阅读:31 
-   Word快速设置标题样式步骤详解 Word快速设置标题样式步骤详解阅读:28 
-   20+道必知必会的Vue面试题(附答案解析) 20+道必知必会的Vue面试题(附答案解析)阅读:37 
-   HTML如何制作表单 HTML如何制作表单阅读:22 
-   百词斩可以改天数吗?当然可以,4个步骤轻松修改天数! 百词斩可以改天数吗?当然可以,4个步骤轻松修改天数!阅读:31 
-   ET文件格式和XLS格式文件之间如何转化? ET文件格式和XLS格式文件之间如何转化?阅读:24 
-   react和vue的区别及优缺点是什么 react和vue的区别及优缺点是什么阅读:121 
-   支付宝人脸识别如何关闭? 支付宝人脸识别如何关闭?阅读:21 
-   腾讯微云怎么修改照片或视频备份路径? 腾讯微云怎么修改照片或视频备份路径?阅读:28 















