GET 与 POST ajax 请求:何时以及如何使用? [英] GET vs. POST ajax requests: When and how to use either?

查看:24
本文介绍了GET 与 POST ajax 请求:何时以及如何使用?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在创建 ajax 请求时,GET 与 POST 相比有何优势,反之亦然?我怎么知道我应该在任何给定时间使用哪个?这是出于安全考虑的决定吗?

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?

此外,它们的实际发送方式有何不同?

Also, what is the difference in how they are actually sent?

推荐答案

POST 请求是您不希望意外发生的请求.GET 请求是用户通过 URL 将浏览器指向的请求.

POST requests are requests that you do not want to accidentally happen. GET requests are requests you are OK with happening by a user pointing a browser to via a URL.

GET 请求可以非常简单地重复,因为它们的数据基于 URL 本身.

GET requests can be repeated quite simply since their data is based in the URL itself.

您应该像考虑常规表单请求(以及它们的 GET 和 POST)一样考虑 AJAX 请求

You should think about AJAX requests like you think about regular form requests (and their GET and POST)

这篇关于GET 与 POST ajax 请求:何时以及如何使用?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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