title: MVC5: Refresh View on button (hyperlink) click?
body: <p>When my MVC5 View loads, I am filling a list for a DropDown on the View and setting the View to only display model records that have a <code>[verified_date]</code> field value older than the <code>cutoff</code>, by default <code>3 Months</code>:</p>
  
  <pre><code>private InventoryTrackerContext db = new InventoryTrackerContext();
  
      // GET: VerifyAssets
      public async Task&lt;ActionResult&gt; Index()
      {
          List&lt;SelectListItem&gt; intervalList = new List&lt;SelectListItem&gt;();
          intervalList.Add(new SelectListItem { Text = "Month", Value = "Month" });
          intervalList.Add(new SelectListItem { Text = "Day", Value = "Day" });
          intervalList.Add(new SelectListItem { Text = "Year", Value = "Year" });
          var cutoffDate = DateTime.Now.AddMonths(-3);
          var iNV_Assets = db.INV_Assets.Where(i =&gt; i.verified_date &lt; cutoffDate).Include(i =&gt; i.Location).Include(i =&gt; i.Manufacturer).Include(i =&gt; i.Model).Include(i =&gt; i.Status).Include(i =&gt; i.Type).Include(i =&gt; i.Vendor);
          ViewBag.intervalList = intervalList;
          return View(await iNV_Assets.ToListAsync());
      }
  </code></pre>
  
  <p>Now what I'm trying to implement, is allow users to specify an interval value and interval setting (values 1-31, and [Month], [Day], [Year]):</p>
  
  <pre><code>    @Html.DropDownList("NumberValueSelection", Enumerable.Range(1, 31).Select(x =&gt; new SelectListItem { Text = x.ToString(), Value = x.ToString() }))
      @Html.DropDownList("intervalList")
      &lt;a href="#" class="btn btn-info btn-sm noDecoration" onclick="newCutoffDate()"&gt;&lt;span class="glyphicon glyphicon-refresh"&gt; REFRESH&lt;/span&gt;&lt;/a&gt;
  </code></pre>
  
  <p>When users click the <code>[REFERSH]</code> button (hyperlink), I want to refresh the view based on user specifications:</p>
  
  <p><strong>SCRIPT</strong>:</p>
  
  <pre><code>    function newCutoffDate() {
          var _value = document.getElementById("NumberValueSelection").value;
          var _interval = document.getElementById("intervalList").value;
          var data = { value: _value, interval: _interval };
          $.ajax({
              type: "POST",
              dataType: "JSON",
              url: '@Url.Action("NewCutoffDateInterval", "VerifyAssets")',
              data: data,
              success: function (resp) {
                  alert("Sucess! Value: " + resp.value + " | Interval: " + resp.interval);
              },
              error: function (resp) {
                  alert("Error! Value: " + resp.value + " | Interval: " + resp.interval);
              }
          })
      }
  </code></pre>
  
  <p><strong>CONTROLLER ACTION</strong>:</p>
  
  <pre><code>    [HttpPost]
      public async Task&lt;ActionResult&gt; NewCutoffDateInterval(int value, string interval)
      {
          var cutoffDate = DateTime.Now.AddMonths(-3);
          if (interval == "Month")
          {
              cutoffDate = DateTime.Now.AddMonths(-value);
          }
          else
          {
              if (interval == "Day")
              {
                  cutoffDate = DateTime.Now.AddDays(-value);
              }
              else
              {
                  if (interval == "Year")
                  {
                      cutoffDate = DateTime.Now.AddYears(-value);
                  }
              }
          }
  
          var iNV_Assets = db.INV_Assets.Where(i =&gt; i.verified_date &lt; cutoffDate).Include(i =&gt; i.Location).Include(i =&gt; i.Manufacturer).Include(i =&gt; i.Model).Include(i =&gt; i.Status).Include(i =&gt; i.Type).Include(i =&gt; i.Vendor);
          return View(await iNV_Assets.ToListAsync());
      }
  </code></pre>
  
  <p>This however is not working. When I click the <code>[REFRESH]</code> button (hyperlink), my function executes and my controller action gets called, but the View does not refresh. All that occurs is that I get a return of <code>"Error! Value: undefined | Interval: undefined".</code>undefined` makes sense considering I'm not returning anything, but why is the View not refreshing?</p>