FAQ 5.40,Ajax和GET [英] FAQ 5.40, Ajax and GET
问题描述
| 5.40为什么使用HTTP GET时我的Ajax页面没有正确更新
|在Internet Explorer中请求?
|
| Microsoft Internet Explorer缓存HTTP GET请求的结果。
|为确保从服务器检索文档,您将获得
|需要使用POST方法。
|
| * http://msdn2.microsoft.com/en-us /library/ms536648.aspx
该主题的MSDN页面为:
| Internet Explorer在
|中缓存HTTP GET请求的结果临时Internet文件(TIF)文件夹。在大多数情况下,缓存改进了
|数据的性能不会经常变化。保证
|结果没有缓存,请使用POST。
微软的建议尽管如此,我仍然认为
对幂等请求的正确请求方法是GET 。还有其他
方法可以绕过缓存,比如
(a)在查询参数中附加一个随机值,或者
(b)在服务器端设置必要的HTTP标头
并非所有地点都能处理POST请求,因此(a)也会更多
兼容和被动解决方案。
- Conrad
| 5.40 Why is my Ajax page not updated properly when using an HTTP GET
| request in Internet Explorer?
|
| Microsoft Internet Explorer caches the results of HTTP GET requests.
| To ensure that the document is retrieved from the server, you will
| need to use the POST Method.
|
| * http://msdn2.microsoft.com/en-us/library/ms536648.aspx
The MSDN page on that topic reads:
| Internet Explorer caches the results of HTTP GET requests in the
| Temporary Internet Files (TIF) folder. In most cases, caching improves
| performance for data that will not change frequently. To guarantee
| that the results are not cached, use POST.
Microsoft''s recommendation notwithstanding, I still think that the
proper request method for idempotent requests is GET. There are other
ways to get around caching, like
(a) appending a random value in a query parameter, or
(b) setting the necessary HTTP headers on the server side
Not all locations can handle POST requests, so (a) would also be a more
compatible and passive solution.
- Conrad
推荐答案
Conrad Lender在comp.lang.javascript上写了20 okt 2008 b> :
Conrad Lender wrote on 20 okt 2008 in comp.lang.javascript:
> | 5.40为什么使用HTTP GET时我的Ajax页面没有正确更新
|在Internet Explorer中请求?
|
| Microsoft Internet Explorer缓存HTTP GET请求的结果。
|为了确保从服务器检索文档,您将
|需要使用POST方法。
|
| * http://msdn2.microsoft.com/en-us /library/ms536648.aspx
该主题的MSDN页面为:
| Internet Explorer在
中缓存HTTP GET请求的结果临时Internet文件(TIF)文件夹。在大多数情况下,缓存改进了
|数据的性能不会经常变化。保证
|结果没有缓存,请使用POST。
微软的建议尽管如此,我仍然认为
对幂等请求的正确请求方法是GET 。还有其他
方法可以绕过缓存,比如
(a)在查询参数中附加一个随机值,或者
(b)在服务器端设置必要的HTTP标头
并非所有地点都能处理POST请求,因此(a)也会更多
兼容和被动解决方案。
>| 5.40 Why is my Ajax page not updated properly when using an HTTP GET
| request in Internet Explorer?
|
| Microsoft Internet Explorer caches the results of HTTP GET requests.
| To ensure that the document is retrieved from the server, you will
| need to use the POST Method.
|
| * http://msdn2.microsoft.com/en-us/library/ms536648.aspx
The MSDN page on that topic reads:
| Internet Explorer caches the results of HTTP GET requests in the
| Temporary Internet Files (TIF) folder. In most cases, caching improves
| performance for data that will not change frequently. To guarantee
| that the results are not cached, use POST.
Microsoft''s recommendation notwithstanding, I still think that the
proper request method for idempotent requests is GET. There are other
ways to get around caching, like
(a) appending a random value in a query parameter, or
(b) setting the necessary HTTP headers on the server side
Not all locations can handle POST requests, so (a) would also be a more
compatible and passive solution.
康拉德,
location是什么意思?
-
Evertjan。
荷兰。
(请将x''es更改为我的电子邮件地址中的点数)
Conrad,
What do you mean by "locations"?
--
Evertjan.
The Netherlands.
(Please change the x''es to dots in my emailaddress)
2008-10-20 23:09,Evertjan。写道:
On 2008-10-20 23:09, Evertjan. wrote:
>并非所有地点都可以处理POST请求,因此(a)也可以更兼容和被动解决方案。
>Not all locations can handle POST requests, so (a) would also be a more
compatible and passive solution.
location是什么意思?
What do you mean by "locations"?
服务地点。网址。例如,我可以使用GET http://slashdot.org/index.pl?issue=20081006"从Slashdot获取页面
。但我无法b / b
发布到 http:// slashdot。 org / index.pl ,put" issue = 20081020"在
请求正文中,并期望得到相同的结果。
- 康拉德
Service locations. URLs. For example, I can fetch a page from Slashdot
with "GET http://slashdot.org/index.pl?issue=20081006". But I couldn''t
POST to http://slashdot.org/index.pl, put "issue=20081020" in the
request body, and expect the same result.
- Conrad
Conrad Lender写道20 okt 2008年在comp.lang.javascript :
Conrad Lender wrote on 20 okt 2008 in comp.lang.javascript:
2008-10-20 23:09,Evertjan。写道:
On 2008-10-20 23:09, Evertjan. wrote:
>>并非所有地点都可以处理POST请求,因此(a)也会更多
兼容和被动解决方案。
>>Not all locations can handle POST requests, so (a) would also be a more
compatible and passive solution.
>location是什么意思?
>What do you mean by "locations"?
服务地点。网址。
Service locations. URLs.
服务地点。 ?
"Service locations." ?
例如,我可以从Slashdot获取页面
For example, I can fetch a page from Slashdot
它们是否与其他URL有任何不同's?
Are they any different from other URL''s?
withGET http://slashdot.org/index.pl?issue=20081006"。但我无法b / b
发布到 http:// slashdot。 org / index.pl ,put" issue = 20081020"在
请求正文中,并期望得到相同的结果。
with "GET http://slashdot.org/index.pl?issue=20081006". But I couldn''t
POST to http://slashdot.org/index.pl, put "issue=20081020" in the
request body, and expect the same result.
这只是因为那个页面是这样设计的,
它也可以设计成一个帖子请求。
我不明白为什么会在常见问题解答中为GET请求提供预备。
你应该使用那个容纳页面'html的那个有问题的代码。
我个人认为服务器端编程允许两个选项,
像ASP请求(问题)
代替ASP的request.querystring(issue)获取GET
和ASP request.form(issue)的POST
将是一个坏习惯,
但这不是手头的话题。
-
Evertjan。
荷兰。
(请将我的电子邮件地址中的x'变为点数)
That is just because that page is designed that way,
it could also be designed as a post request.
I do not see why that would give a pre for the GET request in the FAQ.
You should use the one that accommodates the page''s html-code in question.
I personally think serverside progamming that permits both options,
like ASP request("issue")
in stead of ASP request.querystring("issue") for the GET
and ASP request.form("issue") for the POST
to be a bad habit,
but that is not the topic at hand.
--
Evertjan.
The Netherlands.
(Please change the x''es to dots in my emailaddress)
这篇关于FAQ 5.40,Ajax和GET的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!