title: How to clear form in MVC - ajax.actionlink
body: <p>I tried to clear the form controller and using  ModelState.Clear(); but don't work. I want to clear the form after the form is saved to database. Is there any possibility to refresh the view and clear the form jquery.       </p>
  
  <pre><code> &lt;td&gt;
                      @Ajax.ActionLink("Show Post Order", "_ListPost", new { idOrder = @item.IdOrder }, new AjaxOptions()
                 {
                     HttpMethod = "GET",
                     LoadingElementId = "divLoading",
                     UpdateTargetId = "divPosition",
                     InsertionMode = InsertionMode.Replace
  
                 }, new { @class = "btn btn-primary" })
                  &lt;/td&gt;
                  &lt;td&gt;
  
  
                      @Ajax.ActionLink("Add Answer", "_AddPost", new { idZlecenia = @item.IdZlecenia }, new AjaxOptions()
                 {
                     HttpMethod = "GET",
                     LoadingElementId = "divLoadingForm",
                     UpdateTargetId = "divAddPozycje",
                     InsertionMode = InsertionMode.Replace
  
                 }, new { @class = "btn btn-primary" })
                  &lt;/td&gt;
  
              &lt;/tr&gt;
              ...
              &lt;tr id="divAddPozycje"&gt;&lt;/tr&gt;
          }
  
  [HttpPost]
          [ValidateAntiForgeryToken]
          public PartialViewResult _AddPost(int idOrder, AddPositionViewModel viewModel)
          {
              var findOrder = db.Order.Find(idOrder);
  
              if (ModelState.IsValid)
              {
  
                  OrderPosition position = new OrderPosition { Description = viewModel.Description };
                  db.OrderPosition.Add(position);
                  findOrder.OrderPositionList.Add(position);
                  db.SaveChanges();
                  ViewBag.Information = position;                  
              }
              Thread.Sleep(2000);
              ModelState.Clear();
              return PartialView();              
          } 
  </code></pre>
  
  <blockquote>
    <p>And View _AddPost - Paritial View. This partialView add position to
    orders. The item is added using Html Ajax that adds an item without
    page refresh</p>
  </blockquote>
  
  <pre><code>@model AplikacjaHelpDesk.ViewModels.AddPositionViewModel
  
  @{
      ViewBag.Title = "Add Post";
      Layout = null;
  }
  
  &lt;link href="~/Content/font-awesome.min.css" rel="stylesheet" /&gt;
  &lt;script src="~/Scripts/tinymce/tinymce.min.js"&gt;&lt;/script&gt;
  &lt;script src="~/Scripts/bootstrap.min.js"&gt;&lt;/script&gt;
  &lt;script src="~/Scripts/jquery-2.2.3.min.js"&gt;&lt;/script&gt;   
  &lt;div class="container-fluid"&gt;
      @using (Ajax.BeginForm(new AjaxOptions()
      {
          UpdateTargetId = "divformResult",
          HttpMethod = "Post"
  
      }))    
      {
          @Html.AntiForgeryToken()
          @Html.Hidden("IdOrder")
          &lt;div class="form-horizontal"&gt;
              @Html.ValidationSummary(true, "", new { @class = "text-danger" })
              &lt;div class="form-group"&gt;
                  @Html.LabelFor(model =&gt; model.Description, htmlAttributes: new { @class = "control-label col-md-1" })
                  &lt;div class="col-md-10"&gt;
                      @Html.TextAreaFor(model =&gt; model.Description, new { htmlAttributes = new { @class = "form-control" } })
                      @Html.ValidationMessageFor(model =&gt; model.Description, "", new { @class = "text-danger" })
                  &lt;/div&gt;
              &lt;/div&gt;   
              &lt;div class="form-group"&gt;
                  &lt;div class="col-md-offset-2 col-md-10 "&gt;
                      &lt;input type="submit" value="Save" class="btn btn-danger" /&gt;
                  &lt;/div&gt;
              &lt;/div&gt;
          &lt;/div&gt;
      }        
  &lt;/div&gt;
  </code></pre>
  
  <p>...</p>