我有这样的:jQuery的.getJSON和ASP.NET MVC
$.getJSON("https://scyk.pl/Account/GetSid").done(function (sid) {
settings.parameters.sid = sid;
});
这:
public JsonResult GetSid()
{
return Json(SomeString);
}
.done的jQuery功能不执行 - 为什么?
我有这样的:jQuery的.getJSON和ASP.NET MVC
$.getJSON("https://scyk.pl/Account/GetSid").done(function (sid) {
settings.parameters.sid = sid;
});
这:
public JsonResult GetSid()
{
return Json(SomeString);
}
.done的jQuery功能不执行 - 为什么?
使用Json
,需要一个JsonRequestBehavior
选项并将其设置为AllowGet
return Json("string", JsonRequestBehavior.AllowGet);
只允许POST请求,改变你的控制器动作,以这种倍率:
[HttpPost]
public JsonResult GetSid()
{
return Json(SomeString);
}
那你怎么知道它没有执行? – Musa 2013-04-21 18:07:42
'settings.parameters.sid'为null,如果我把'console.log(“done”)'放在那里,什么也没有发生 – ojek 2013-04-21 18:10:24