【发布时间】:2011-04-30 13:26:43
【问题描述】:
Ajax.BeginForm 调用一个动作,然后返回 JSON。
如何在我的OnComplete js 函数中访问 JSON 对象?
所以我的Ajax.BeginForm 看起来像这样......
using (Ajax.BeginForm("Coupon", new AjaxOptions { OnSuccess = "CouponSubmitted" }))
我的OnSuccess 函数看起来像这样......
function CouponSubmitted() {
var data = response.get_response().get_object();
alert(data.success);
}
我也试过了……
function CouponSubmitted(data) {
alert(data.success);
}
我的控制器“优惠券”返回这个...
return Json(new { success = false, nameError = nameError, emailError = emailError });
有关如何访问返回的 Json 的任何想法?
【问题讨论】:
标签: asp.net-mvc json jquery