title: knockout.js redirect in view model
body: <p>I have the following code on cshtml page.</p>
  
  <pre><code> &lt;div class="buttons"&gt;
      &lt;button type="button" id="export" class="export-inventory-button" onclick="location.href='@Url.Action("ExportInventory", "Inventory")'"&gt;EXPORT INVENTORY&lt;/button&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>How do I make this work in my view model?</p>
  
  <p>I think I almost got it, but need some help</p>
  
  <pre><code>&lt;div class="buttons"&gt;
      &lt;button type="button" id="export" class="export-inventory-button" data-bind="click: exportInventory"&gt;EXPORT INVENTORY&lt;/button&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>My viewmodel has this code:</p>
  
  <pre><code> function exportInventory() {
                  filtererGridData = vm.details;
  
                  var json = ko.mapping.toJSON(vm.details);
  
                  $.ajax({ url: '/Inventory/ExportInventory', type: 'POST' }).done(function (data) {
                      $('#export').html(data);
                  }).fail(function (data) {
                      toastr.warn('Could not export data, please contact LGL.');
                  });
              }
  </code></pre>
  
  <p>I tried this, but I get errors:</p>
  
  <pre><code>function exportInventory() {
                  filtererGridData = vm.details;
  
                  var json = ko.mapping.toJSON(vm.details);
  
                  $.ajax({ url: 'location.href="@Url.Action("ExportInventory", "Inventory")"', type: 'POST' }).done(function (data) {
                      window.location.href = responseText.url;
                      $('#export').html(data);
                  }).fail(function (data) {
                      toastr.warn('Could not export data, please contact LGL.');
                  });
              }
  </code></pre>
  
  <p>Can someone help me figure this out?</p>