刷新后不执行onreadystatechange

李睿_Lee 2008-07-19 10:42:30
其中关键的函数如下:
FCKXml.prototype.request = function( url , postString , fmethod , asyncFunctionPointer , funcParam )
{
var C = this.getTransport();
C.open( fmethod , url , true );
if(fmethod=="post")
C.setRequestHeader( 'Content-Type' , 'application/x-www-form-urlencoded' );
C.send( postString );
alert("start loading");//开始的提示
C.onreadystatechange = function ()
{alert(C.readyState)//状态改变提示,以便清楚地知道状态有没有改变
if( C.readyState == 4 )
{
if(asyncFunctionPointer)
{
if ( C.status==200 || C.status==304 )
{
asyncFunctionPointer( C );
}
}
}
}
}

奇怪的是,在FireFox下没有任何问题,在Maxthon或者IE6下,首次打开页面,一切正常,刷新一下,就没有状态改变提示了,说明状态不改变。这样一来,就达到效果了。
不知道有没有人遇到这样的问题。
是什么原因造成的呢?
请指教。多谢!
...全文
166 4 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
李睿_Lee 2008-07-21
  • 打赏
  • 举报
回复
[Quote=引用 1 楼 tantaiyizu 的回复:]
其实不难的 ,你只需要检查是否执行了 请求 ,查看C.responseText 看看
[/Quote]
你这个提醒了我。
经过测试,原来是缓存做的怪。禁用缓存就没问题了。
李睿_Lee 2008-07-21
  • 打赏
  • 举报
回复
没有多个,页面里就一个Ajax应用。
sagadan 2008-07-20
  • 打赏
  • 举报
回复
你用了多个request吧?
试试开始时取消数据发送...http_request.abort();
不行就只能慢慢调试了..慢慢alert
tantaiyizu 2008-07-19
  • 打赏
  • 举报
回复
其实不难的 ,你只需要检查是否执行了 请求 ,查看C.responseText 看看

52,792

社区成员

发帖
与我相关
我的任务
社区描述
Web 开发 Ajax
社区管理员
  • Ajax
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧