【发布时间】:2011-04-14 20:04:20
【问题描述】:
我的 ASP.NET MVC 操作是这样写的:
//
// GET: /TaxStatements/CalculateTax/{prettyId}
public ActionResult CalculateTax(int prettyId)
{
if (prettyId == 0)
return Json(true, JsonRequestBehavior.AllowGet);
TaxStatement selected = _repository.Load(prettyId);
return Json(selected.calculateTax, JsonRequestBehavior.AllowGet); // calculateTax is of type bool
}
我遇到了这个问题,因为在 jquery 函数中使用它时出现各种错误,主要是 toLowerCase() 函数失败。
所以我必须更改操作,使其返回 bool 作为字符串(在 bool 值上调用 ToString()),以便返回 true 或 false(在 qoutes 中),但我有点不不喜欢。
其他人如何处理这种情况?
【问题讨论】:
标签: asp.net jquery asp.net-mvc json