GET vs. POST ajax requests: When and how to use either?

后端 未结 4 591
野的像风
野的像风 2020-12-15 05:01

What are the strengths of GET over POST and vice versa when creating an ajax request? How do I know which I should use at any given time? Is it a security-minded decision?

4条回答
  •  别那么骄傲
    2020-12-15 05:37

    The Yahoo! Mail team found that when using XMLHttpRequest, POST is implemented in the browsers as a two-step process: sending the headers first, then sending data. So it's best to use GET, which only takes one TCP packet to send (unless you have a lot of cookies). The maximum URL length in IE is 2K, so if you send more than 2K data you might not be able to use GET.

    http://developer.yahoo.com/performance/rules.html#ajax_get

提交回复
热议问题