0

I'm trying to pass multiple objects to my jquery post data object like this:

 return View("AffiliateManager", /*and now pass the JSON flag here*/);

The "JSON Flag" would be just this:

Json("Ok"); => signaling that call was success

So that I can fetch both HTML of the page and the "OK" parameter in my jquery post data object like this:

 .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);
                     }
                 });

So now that I have in data object like this:

data.html => whole HTML of the page
data.flag => signal whether the call was good

How can I achieve this in .NET MVC ?

Jadin Stojadin
  • 215
  • 2
  • 14
  • 1
    See this [Return Partial View and JSON from ASP.NET MVC Action](http://stackoverflow.com/questions/18667447/return-partial-view-and-json-from-asp-net-mvc-action) – Shyju Dec 28 '16 at 13:09

1 Answers1

1

You can try this code;

Json(new { html = "Html String Here" , flag = "Ok" } , JsonRequestBehavior.AllowGet);
pridemkA
  • 124
  • 4