Post jqueryajaxget失败

Post jqueryajaxget失败,post,jquery,get,Post,Jquery,Get,我在.js文件中有以下jQuery ajax请求: $.ajax({ type: "GET", url: "Download.aspx/ZipCheck", contentType: "application/json; charset=utf-8", data: "{}", dataType: "json", success: AjaxSucceeded, error: AjaxFailed }); function AjaxSucceeded(result) {

我在.js文件中有以下jQuery ajax请求:

$.ajax({
  type: "GET",
  url: "Download.aspx/ZipCheck",
  contentType: "application/json; charset=utf-8",
  data: "{}",
  dataType: "json",
  success: AjaxSucceeded,
  error: AjaxFailed
});

function AjaxSucceeded(result) {
  alert(result.d);
}

function AjaxFailed(result) {
  alert(result.status + ' ' + result.statusText);
}
请求失败,会弹出一个警报,提示“200 OK”。但是,如果我将ajax请求类型更改为“POST”,那么它就会工作,并且会弹出一个警报,其中包含从Download.aspx/ZipCheck返回的预期数据

为什么GET失败,为什么POST成功?我对两者之间区别的理解肯定有缺陷,因为我认为GET请求仍然会从服务器返回一些东西

,您需要显式启用GET请求,例如在上使用,如下所示:

[WebMethod, ScriptMethod(UseHttpGet=true)]
public thing ZipCheck() {
  //return object
}

如果Nick的答案不能解决IE GET缓存问题,那么也可以查看一下。啊,我明白了。使用GET over POST有什么好处吗?我的意思是,当你可以只使用一个帖子请求并完成它时,为什么还要努力启用你的webmethods呢?@Jagd-请参阅博客帖子,安全问题的第一个链接……我想说,使用帖子并完成它:)感谢Scott Guthries的博客链接。我现在一定会坚持使用POST。:)