我试图将多个对象传递给我的jquery post数据对象,如下所示:
return View("AffiliateManager", /*and now pass the JSON flag here*/);
" JSON标志"就是这样:
Json("Ok"); => signaling that call was success
这样我就可以获取页面的HTML和" OK"我的jquery post数据对象中的参数如下:
.done(function (data) {
if (data == "ErrorRequest") {
ShowErrorMessage("You don't have enough money to request payment!");
$('.btnRequestPayout').prop('disabled', false);
return;
}
else if(data=="Ok"){
ShowMessage("Payment request successfully made.");
$('.btnRequestPayout').prop('disabled', false);
var wholePage = $('<div />').append(data).find('#divPage').html();
$('#divPage').html(wholePage);
}
});
所以现在我有这样的数据对象:
data.html => whole HTML of the page
data.flag => signal whether the call was good
如何在.NET MVC中实现这一目标?
答案 0 :(得分:1)
您可以尝试使用此代码;
Json(new { html = "Html String Here" , flag = "Ok" } , JsonRequestBehavior.AllowGet);