我有这个:
$.getJSON("https://scyk.pl/Account/GetSid").done(function (sid) {
settings.parameters.sid = sid;
});
还有这个:
public JsonResult GetSid()
{
return Json(SomeString);
}
jquery 的 .done 函数没有执行 - 为什么?
最佳答案
使用采用 JsonRequestBehavior
选项的 Json
重写,并将其设置为 AllowGet
return Json("string", JsonRequestBehavior.AllowGet);
要仅允许发布请求,请将 Controller 操作更改为:
[HttpPost]
public JsonResult GetSid()
{
return Json(SomeString);
}
关于javascript - Jquery .getJSON 和 ASP.NET MVC,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16134466/