YSlow里有一条规则叫Use GET for AJAX requests,即“使用GET方式请求AJAX”,YSlow中的解释如下:
When using the XMLHttpRequest object, the browser implements POST in two steps: (1) send the headers, and (2) send the data. It is better to use GET instead of POST since GET sends the headers and the data together (unless there are many cookies). IE’s maximum URL length is 2 KB, so if you are sending more than this amount of data you may not be able to use GET.
翻译:
当使用XMLHttpRequest对象时,浏览器通过两个步骤实现POST:(1)发送请求头;(2)发送数据。而GET的请求头和数据是一起发送的(除非包含很多cookie),所以使用GET方式更好些。IE支持的最大URL长度是2KB,所以你的数据很长的话就不能用GET了。
这段话蜻蜓点水,只说了GET和POST的这两个差别,而实际使用中会是这么简单吗?
