title: Knockout asyncCommand / Ajax MVC ActionResults
body: <p>I am pretty new to front end development and also the project I’m working on (bug fixes). I am using Knockout/MVC ActionResults. </p>
  
  <p>I have been tasked to alter a form so that it doesn't allow double click submission, I added basic Jquery to disable to button, but have been told it needs to use asyncCommand.</p>
  
  <p>What I have noted about it however is that all examples using this they return a Json result etc. where mine will be an action result.</p>
  
  <p>I was wondering if I need to alter the MVC actionresult or whether there is another way that I’m just not seeing.</p>
  
  <p>I was hoping I could do something like:</p>
  
  <p>HTML</p>
  
  <pre><code>&lt;button class="btn btn-action" data-bind="command: create, activity: create.isExecuting"&gt;Create&lt;/button&gt; 
  </code></pre>
  
  <p>JS</p>
  
  <pre><code> model.create = ko.asyncCommand({
          execute: function (complete) {
              $.ajax({
                  type: 'POST',
                  url: "/account/create",
                  data: ko.toJSON(data),
                  contentType: 'application/json; charset=utf-8',
              });
          complete();
          },
          canExecute: function (isExecuting) {
              return !isExecuting;
          }
      });
  </code></pre>
  
  <p>CONTROLLER</p>
  
  <pre><code>        public ActionResult Create(Model model, int versionId)
          {
  
  if (success)
                  {
                      return Redirect("/accounts");
                  }
  else
                  {
                      return View(model);
                  }
  }
  </code></pre>
  
  <p>Can this actually happen or not?</p>
  
  <p>Thanks,</p>
  
  <p>Clare</p>