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 ?

1

1 Answer 1

1

You can try this code;

Json(new { html = "Html String Here" , flag = "Ok" } , JsonRequestBehavior.AllowGet);
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.