title: Reload Div on button click
body: <p>I have a MVC view that has bootstrap navtabs in it. On each tab a different view loads.  They are called delayed spiff, and instantspiff. I have added a datepicker and a button that should display data in the 2 views. The only problem is that when I click my button the views don't refresh. They keep their original data instead of the new data based on the date.  I need to somehow reload the view after the date is selected and then show the new data.  I'll share some of my code.  Here's my code:</p>
  
  <p>Main view:</p>
  
  <pre><code>&lt;div class="container-fluid delayed_spiff_main"&gt;
  
  
  &lt;div class="row-fluid 1"&gt;
      &lt;div class="col-lg-12 delayed_spiff_body"&gt;
  
          &lt;div class="row spiff-datepicksection"&gt;
              &lt;div class="col-lg-6 pull-right"&gt;
                  &lt;div class="col-sm-5 col-lg-offset-4"&gt;
                      &lt;div class="form-group"&gt;
                          &lt;div class="input-group date"&gt;
                              &lt;input type="text" id="startDate" class="form-control" /&gt;
                              &lt;span class="input-group-addon"&gt;
                                  &lt;span class="glyphicon glyphicon-calendar"&gt;&lt;/span&gt;
                              &lt;/span&gt;
                          &lt;/div&gt;
                      &lt;/div&gt;
                  &lt;/div&gt;
                  &lt;div class="col-lg-3"&gt;
                      &lt;input class="spiffdate-btn" type="button" value="Submit" /&gt;
                  &lt;/div&gt;
              &lt;/div&gt;
          &lt;/div&gt;
  
  
          &lt;div class="row spiff_tabs_body"&gt;
              &lt;!-- Nav tabs --&gt;
  
              &lt;ul class="nav nav-tabs spiff_tabs" role="tablist"&gt;
                  &lt;li role="presentation" class="active"&gt;
                      &lt;a href="#home" aria-controls="home" role="tab" data-id="delayedspiff" data-toggle="tab" onclick="FormGet('dashboard/delayedspiff', 'delayedspiff')"&gt;Potential Spiff&lt;/a&gt;
                  &lt;/li&gt;
                  &lt;li role="presentation"&gt;
                      &lt;a href="#profile" aria-controls="profile" role="tab" data-id="instantspiff" data-toggle="tab" onclick="FormGet('dashboard/instantspiff', 'delayedspiff')"&gt;Instant Spiff&lt;/a&gt;
                  &lt;/li&gt;
              &lt;/ul&gt;
              &lt;!-- Tab panes --&gt;
              &lt;div class="tab-content"&gt;
                  &lt;div role="tabpanel" class="tab-pane active" id="delayedspiff"&gt;&lt;/div&gt;
                  &lt;div role="tabpanel" class="tab-pane" id="instantspiff"&gt;&lt;/div&gt;
              &lt;/div&gt;
          &lt;/div&gt;
      &lt;/div&gt;
  &lt;/div&gt;
  
  &lt;script&gt;
      $(function () {
      FormGet('dashboard/delayedspiff', 'delayedspiff');
  });
  &lt;/script&gt;
  </code></pre>
  
  <p>javascript to load details in view:</p>
  
  <pre><code>function pullDetails(carrierId, startDate, status, divid) {
  
      $.get("@Url.Action("getDelayedSpiffOrderDetails", "Dashboard")",
          { carrierId: carrierId, startDate: startDate, status: status },
          function (data) {
              $('.' + divid + ' .submitted_details').html(data);
              $('.' + divid).removeClass('carrier-hide');
  
          });
  
  }
  </code></pre>
  
  <p>And just to make this even more confusing here is my Controller code:</p>
  
  <pre><code>public ActionResult DelayedSpiff(DateTime? startDate)
      {
          var available = _appService.GetFeatureStatus(1, "spiffDashboard");
          if (!available)
              return RedirectToAction("DatabaseDown", "Error", new { area = "" });
  
          //var startDate = DateTime.Today.AddDays(-6);
  
          if (!startDate.HasValue || startDate.Value == DateTime.MinValue)
          {
              startDate = DateTime.Today.AddDays(-7);
          }
          else
          {
              startDate = startDate.Value.AddDays(-7);                
          }           
  
          var acctId = User.AccountID;
  
          var endDate = DateTime.Today.AddDays(1); // 1
  
          Dictionary&lt;DateTime, List&lt;SpiffSummaryModel&gt;&gt; dict = new Dictionary&lt;DateTime,List&lt;SpiffSummaryModel&gt;&gt;();
  
          try
          {
              var properties = new Dictionary&lt;string, string&gt;
              {
                  { "Type", "DelayedSpiff" }
              };
              telemetry.TrackEvent("Dashboard", properties);
  
              dict = _reportingService.GetDailyDelayedSpiffSummaries(acctId, startDate.Value, endDate);
  
          }
          catch (Exception e)
          {
              if (e.InnerException is SqlException &amp;&amp; e.InnerException.Message.StartsWith("Timeout expired"))
              {
                  throw new TimeoutException("Database connection timeout");
              }
              var error = _errorCodeMethods.GetErrorModelByTcError(PROJID.ToString("000") + PROCID.ToString("00") + "001", "Exception Getting DelayedSpiff Dashboard View", PROJID, PROCID);
              error.ErrorTrace = e.ToString();
              _errorLogMethods.LogError(error);
              return RedirectToAction("index", "error", new { error = error.MaskMessage });
          }
  
          var spiffDateModels = new List&lt;DelayedSpiffDateModel&gt;();
  
          foreach (var entry in dict)
          {
              var spiffDateModel = new DelayedSpiffDateModel();
  
              spiffDateModel.Date = entry.Key;
  
              spiffDateModel.Carriers = new List&lt;DelayedSpiffCarrierModel&gt;();
  
              foreach (var item in entry.Value)
              {
                  var spiffCarrierModel = new DelayedSpiffCarrierModel();
                  spiffCarrierModel.Carrier = item.CarrierName;
                  spiffCarrierModel.CarrierId = item.CarrierId;
                  spiffCarrierModel.ApprovedSpiffTotal = item.ApprovedSpiffTotal;
                  spiffCarrierModel.EligibleActivationCount = item.EligibleActivationCount;
                  spiffCarrierModel.IneligibleActivationCount = item.IneligibleActivationCount;
                  spiffCarrierModel.PotentialSpiffTotal = item.PotentialSpiffTotal;
                  spiffCarrierModel.SubmittedActivationCount = item.SubmittedActivationCount;
                  spiffCarrierModel.UnpaidSpiffTotal = item.UnpaidSpiffTotal;
                  spiffDateModel.Carriers.Add(spiffCarrierModel);
              }
  
              spiffDateModels.Add(spiffDateModel);
          }
          spiffDateModels = spiffDateModels.OrderByDescending(x =&gt; x.Date).ToList();
  
          return PartialView(spiffDateModels);
      }
  </code></pre>
  
  <p>UPDATE code that loads inside of tabpanel:</p>
  
  <pre><code>&lt;div class="container-fluid"&gt;
  &lt;div class="row"&gt;
      &lt;div class="col-lg-11 col-center-block delayspiffdata" id="details"&gt;
  
  
  
          &lt;table class="delay_spiff_tbl"&gt;
              &lt;thead&gt;
                  &lt;tr&gt;
                      &lt;th class="blank"&gt;&lt;/th&gt;
                      &lt;th&gt;Submitted Activations / Potential Spiff&lt;/th&gt;
                      &lt;th&gt;Approved Activations / Approved Spiff&lt;/th&gt;
                      &lt;th&gt;Ineligible Activations / Unpaid Spiff&lt;/th&gt;
                  &lt;/tr&gt;
              &lt;/thead&gt;
  
              &lt;tbody&gt;
                  @for (int date = 0; date &lt; Model.Count; date ++)
                  {
                      &lt;tr class="date-row" onclick="$('.date_@date').toggleClass('date-hide');"&gt;
                          &lt;td class="spiffdate"&gt;
                              @Model[date].Date.ToString("dddd MM/dd/yyyy")
                              &lt;i class="fa fa-plus-circle expander_open" &gt;&lt;/i&gt;
                          &lt;/td&gt;
                          &lt;td&gt;@Model[date].Carriers.Sum(c =&gt; c.SubmittedActivationCount) / @Model[date].Carriers.Sum(c =&gt; c.PotentialSpiffTotal).ToString("C")&lt;/td&gt;
  
                          &lt;td&gt;@Model[date].Carriers.Sum(c =&gt; c.EligibleActivationCount) / @Model[date].Carriers.Sum(c =&gt; c.ApprovedSpiffTotal).ToString("C")&lt;/td&gt;
  
                          &lt;td&gt;@Model[date].Carriers.Sum(c =&gt; c.IneligibleActivationCount) / @Model[date].Carriers.Sum(c =&gt; c.UnpaidSpiffTotal).ToString("C")&lt;/td&gt;
                      &lt;/tr&gt;
  
                      for (int carrier = 0; carrier &lt; Model[date].Carriers.Count; carrier++)
                      {
                          &lt;tr class="date_@date date-hide" onclick="$('.submitted-@date-@carrier').toggleClass('carrier-hide');"&gt;
                              &lt;td&gt;&lt;span class="pull-left dash"&gt;&lt;i class="fa fa-caret-up"&gt;&lt;/i&gt;&lt;/span&gt; @Model[date].Carriers[carrier].Carrier&lt;/td&gt;
                              &lt;td&gt;
                                  &lt;a onclick="pullDetails('@Model[date].Carriers[carrier].CarrierId', '@Model[date].Date', 'potential' ,'submitted-@date-@carrier')"&gt;
                                      @(Model[date].Carriers[carrier].SubmittedActivationCount == 0 ? "--" :
                                      Model[date].Carriers[carrier].SubmittedActivationCount + " / " +
                                      Model[date].Carriers[carrier].PotentialSpiffTotal.ToString("C"))
                                  &lt;/a&gt;
                              &lt;/td&gt;
                              &lt;td&gt;
                                  &lt;a onclick="pullDetails('@Model[date].Carriers[carrier].CarrierId', '@Model[date].Date', 'eligible' ,'submitted-@date-@carrier')"&gt;
                                      @(Model[date].Carriers[carrier].EligibleActivationCount == 0 ? "--" :
                                      Model[date].Carriers[carrier].EligibleActivationCount + " / " +
                                      Model[date].Carriers[carrier].ApprovedSpiffTotal.ToString("C"))
                                  &lt;/a&gt;
                              &lt;/td&gt;
                              &lt;td&gt;
                                  &lt;a onclick="pullDetails('@Model[date].Carriers[carrier].CarrierId', '@Model[date].Date', 'ineligible' ,'submitted-@date-@carrier')"&gt;
                                      @(Model[date].Carriers[carrier].IneligibleActivationCount == 0 ? "--" :
                                      Model[date].Carriers[carrier].IneligibleActivationCount + " / " +
                                      Model[date].Carriers[carrier].UnpaidSpiffTotal.ToString("C"))
                                  &lt;/a&gt;
                              &lt;/td&gt;
                          &lt;/tr&gt;
  
                          &lt;tr class="date_@date date-hide submitted-@date-@carrier carrier-hide carrier"&gt;
                              &lt;td class="submitted_details" colspan="100%"&gt;
                              &lt;/td&gt;
                          &lt;/tr&gt;
                      }
                  }
              &lt;/tbody&gt;
          &lt;/table&gt;
      &lt;/div&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p></p>
  
  <pre><code>&lt;script&gt;
  $(function () {
      $('.date-row').click(function () {
          $(this).find('i').toggleClass('fa-minus-circle fa-plus-circle');
      });
  });
  $(function () {
      $('.date-hide').click(function () {
          $(this).find('i').toggleClass('fa-caret-down fa-caret-up');
      });
  });
  
  function pullDetails(carrierId, startDate, status, divid) {
      $.get("@Url.Action("getDelayedSpiffOrderDetails", "Dashboard")",
          { carrierId: carrierId, startDate: startDate, status: status },
          function (data) {
              $('.' + divid + ' .submitted_details').html(data);
              $('.' + divid).removeClass('carrier-hide');
  
          });        
  }
  </code></pre>
  
  <p></p>