【发布时间】:2017-05-12 18:42:00
【问题描述】:
我正在尝试将多个对象传递给我的 jquery 发布数据对象,如下所示:
return View("AffiliateManager", /*and now pass the JSON flag here*/);
“JSON 标志”就是这样:
Json("Ok"); => signaling that call was success
这样我就可以同时获取页面的 HTML 和我的 jquery 发布数据对象中的“OK”参数,如下所示:
.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 中实现这一点?
【问题讨论】:
标签: javascript jquery asp.net asp.net-mvc asp.net-mvc-5