代码如下:
var xmlhttp = createxmlhttp();
xmlhttp.open("POST",path+"/xxx.jsp",true);//这里的xxx.jsp是加入XML数据的
xmlhttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
xmlhttp.send("big=<%=big%>&time="+new Date().getTime());
xmlhttp.onreadystatechange=function(){
if(xmlhttp.readyState==4)
{if(xmlhttp.status==200){
if(xmlhttp.responseText){getxml();} //有返回了去显示XML文件
}
else
{}}}
}
本想异步发出请求,数据添加完后再来显示XML的数据,可是就是得不到最新的数据,要过一会儿刷新才会有,时间好像有2,3秒,然后查资料说用同步,于是我改成下面这种,
var xmlhttp = createxmlhttp();
xmlhttp.open("POST",path+"/xxx.jsp",false);//这里的xxx.jsp是加入XML数据的
xmlhttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
xmlhttp.send("big=<%=big%>&time="+new Date().getTime());
if(xmlhttp.responseText){getxml();}//说同步后就不用onreadystatechange了,如果不去掉这个IE和FF都不执行了,也不报错。这样也可以运行,但还是没有同步,更没有什么挂起IE操作这种效果,难道只能用刷新程序吗?还有用刷新要怎么用呢?判断什么条件?
var xmlhttp = createxmlhttp();
xmlhttp.open("POST",path+"/xxx.jsp",true);//这里的xxx.jsp是加入XML数据的
xmlhttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
xmlhttp.send("big=<%=big%>&time="+new Date().getTime());
xmlhttp.onreadystatechange=function(){
if(xmlhttp.readyState==4)
{if(xmlhttp.status==200){
if(xmlhttp.responseText){getxml();} //有返回了去显示XML文件
}
else
{}}}
}
本想异步发出请求,数据添加完后再来显示XML的数据,可是就是得不到最新的数据,要过一会儿刷新才会有,时间好像有2,3秒,然后查资料说用同步,于是我改成下面这种,
var xmlhttp = createxmlhttp();
xmlhttp.open("POST",path+"/xxx.jsp",false);//这里的xxx.jsp是加入XML数据的
xmlhttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
xmlhttp.send("big=<%=big%>&time="+new Date().getTime());
if(xmlhttp.responseText){getxml();}//说同步后就不用onreadystatechange了,如果不去掉这个IE和FF都不执行了,也不报错。这样也可以运行,但还是没有同步,更没有什么挂起IE操作这种效果,难道只能用刷新程序吗?还有用刷新要怎么用呢?判断什么条件?
xmlhttp.open("POST",path+"/xxx.jsp?time="+new Date().getTime(),true)。
var xmlhttp[1] = createxmlhttp();
var xmlhttp[2] = createxmlhttp();