title: How to send back message from controller to view
body: <p>I want to popup success or failure notification of form after form submission.</p>
  
  <p>I have a Partial View as <code>_Appointment.cshtml</code> with a form on it.</p>
  
  <p>I have one Main view Index on which i am loading it like this</p>
  
  <pre><code>@{Html.RenderPartial("~/Views/Appointments/_Appointment.cshtml", Model);}
  </code></pre>
  
  <p>In Controller i have </p>
  
  <pre><code>[HttpPost]
  [ValidateAntiForgeryToken]
  public JsonResult _Appointment_public(Appointments appointments)
  {
      if (ModelState.IsValid)
      {          
          db.Appointments.Add(appointments);
          db.SaveChanges();
          // return RedirectToAction("Index");
          ViewBag.Success = "Successfull";
          // RedirectToAction("../Home/Index");           
      }
  
      return Json(new {message = "Test" });
  }
  </code></pre>
  
  <p>How do I pass and accept JSON Data to my view?</p>