问题描述
这两个AJAX调用之间有什么区别?为什么在使用asp.net mvc框架时选择使用其中一个?
What is the difference between those two AJAX calls and why would I choose to use either when using the asp.net mvc framework?
推荐答案
一个使用POST,另一个使用GET.
One uses POST and one uses GET.
就其含义而言-唯一真正的技术差异(如果我错了,请更正此帖子)是GET对查询字符串的限制要短得多.实际上,GET是用于从服务器获取内容时使用的. GET调用不应在服务器上造成副作用. POST是您打算在服务器上发送内容并对其执行某些操作的时候.
As far as what they're meant for - the only real technical difference (please correct this post if I'm wrong) is that GET has a much shorter limit to the query string. In practice, GET is meant for when fetching something from the server. A GET call should not cause side effects on the server. POST is when you intend to send something on the server and have it do something with it.
edit:我正在寻找的用来描述GET的单词是幂等的.您应该能够无限制地进行完全相同的GET调用,并且每次都获得相同的结果,而对服务器没有任何影响(当然,前提是没有其他人更改过服务器的状态.)但是请记住,不会阻止您滥用GET或POST的技术障碍.
edit: the word I was looking for, to describe GET, is idempotent. You should be able to make the exact same GET call an unlimited number of times, and get the same result every time, with no consequence to the server (provided of course that no one else has changed the server's state.) But remember that there are no technical barriers preventing you from misusing either GET or POST.
这篇关于jquery.post和jquery.get之间的区别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!