XMLhttp请求问题 [英] XMLhttp request problem

查看:55
本文介绍了XMLhttp请求问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好


i我正在使用asp.net v2.0


在我的一个页面中,我使用xml http调用另一个页面,这是

工作正常,但仅限第一次,

我点击按钮发送请求,当我点击按钮

第二次,它回复了之前的回复,它甚至没有再次调用该页面,这可能是问题所在。


客户端(aspx第1页javascript)


var http =新ActiveXObject(" Msxml2.XMLHTTP");

http.open(" ; GET"," Gensparql.aspx",false);

http.send();

if(http.readyState == 4)

{

if(http.responseText!= null&& http.responseText!='''')

{

//我的流程

}

}


服务器端(aspx第2页)


Response.Clear();

Response.ContentType =" text / xml";

回复se.Write(retVal);

Response.End();


//第二次返回相同的上一个输出而不是调用aspx

第2页

希望你明白我的问题,我很紧急,提前致谢

Hi all

i am using asp.net v2.0

In one of my page i am calling another page using xml http , this is
working fine but first time only ,

I am sending the request on click of button , when i click the button
second time, it''s returning the previous response and it''s not even
calling that page again, where could be the problem.

client side (aspx page 1- javascript)

var http=new ActiveXObject("Msxml2.XMLHTTP");
http.open("GET","Gensparql.aspx",false);
http.send();
if(http.readyState == 4)
{
if(http.responseText!=null && http.responseText!='''' )
{
//my process
}
}

server side (aspx page 2)

Response.Clear();
Response.ContentType = "text/xml";
Response.Write(retVal);
Response.End();

//second time returning same previous output and not calling the aspx
page 2
Hope u understand my problem,i am in urgent, Thanks in advance

推荐答案

su *************** @ gmail .com escribió:
大家好

我正在使用asp.net v2.0

在我的一个页面我是使用xml http调用另一个页面,这是工作正常但仅限第一次,

我点击按钮发送请求,当我第二次单击按钮时,它正在返回之前的响应并且它甚至没有再次调用该页面,这可能是问题所在。

客户端(aspx第1页-javascript)
var http = new ActiveXObject(" Msxml2.XMLHTTP");
http.open(" GET"," Gensparql.aspx",false);
http.send( );
if(http.readyState == 4)
{
if(http.responseText!= null&& http.responseText!='''')
//
//我的过程
}

服务器端(aspx第2页) Response.ContentType =" text / xml";
Response.Write(retVal);
Response.End();

//第二次返回相同的上一个输出而不是调用aspx
第2页
希望你理解我的问题,我很紧急,提前致谢
Hi all

i am using asp.net v2.0

In one of my page i am calling another page using xml http , this is
working fine but first time only ,

I am sending the request on click of button , when i click the button
second time, it''s returning the previous response and it''s not even
calling that page again, where could be the problem.

client side (aspx page 1- javascript)

var http=new ActiveXObject("Msxml2.XMLHTTP");
http.open("GET","Gensparql.aspx",false);
http.send();
if(http.readyState == 4)
{
if(http.responseText!=null && http.responseText!='''' )
{
//my process
}
}

server side (aspx page 2)

Response.Clear();
Response.ContentType = "text/xml";
Response.Write(retVal);
Response.End();

//second time returning same previous output and not calling the aspx
page 2
Hope u understand my problem,i am in urgent, Thanks in advance



也许您必须发送HTTP标头,通知

内容的可缓存性。你可以写它以便立即过期。顺便说一句,不要使用

只有ActiveX,否则其他(符合标准的)浏览器不能用你的页面工作



Andrew [knocte]


-


Perhaps you must send HTTP headers informing about how cacheable is the
content. You could write it so as to expire immediately. BTW, don''t use
only ActiveX, or else other (standards compliant) browsers won''t work
with your page.

Andrew [ knocte ]

--


在网址后面附加一个随机数调用。浏览器

不会使用缓存。请确保为每次通话使用不同的随机数




http.open(" GET"," Gensparql.aspx?nocache = 4687321567 95431,false;

Append a random number after the url that''s being called. The browser
will not use the cache. Just make sure to use a different random number
for each call.

http.open("GET","Gensparql.aspx?nocache=4687321567 95431",false);


Jambalaya在10/12/2005 10:25 AM上发表以下内容:
Jambalaya said the following on 10/12/2005 10:25 AM:
追加在被调用的URL之后的随机数。


这是为了什么?

浏览器不会使用缓存。


我会告诉它。

只要确保为每个电话使用不同的随机数。


每次调用什么?

http.open(GET,Gensparql.aspx?nocache = 4687321567 95431,false);
Append a random number after the url that''s being called.
And what is that for?
The browser will not use the cache.
It will if I tell it to.
Just make sure to use a different random number for each call.
Each call of what?

http.open("GET","Gensparql.aspx?nocache=4687321567 95431",false);




哦等等,我现在看到了。如果你打算引用你所回复的内容

就会更容易看出你的方法有一个简单的缺陷。

而不是只是想猜测一个随机数,你以毫秒为单位追加

当前时间。


-

兰迪

comp.lang.javascript常见问题 - http://jibbering.com/faq &新闻组每周

答:它会破坏对话的顺序

问题:为什么?

答案:热门发布。

问题:Usenet上最烦人的事情是什么?



Oh wait, I see now. If you had bothered to quote what you were replying
to it would be easier to see that your approach has a simple flaw in it.
Instead of just trying to guess at a random number, you append the
current time in milliseconds.

--
Randy
comp.lang.javascript FAQ - http://jibbering.com/faq & newsgroup weekly
Answer:It destroys the order of the conversation
Question: Why?
Answer: Top-Posting.
Question: Whats the most annoying thing on Usenet?


这篇关于XMLhttp请求问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆