title: knockoutJS - ajax form submitting twice
body: <p>I have a form that's being submitted twice. </p>
  
  <p>I've looked through similar jQuery-related questions <a href="https://stackoverflow.com/questions/15823756/jquery-submitting-form-twice">here</a> and <a href="https://stackoverflow.com/questions/15823756/jquery-submitting-form-twice">here</a> and google groups <a href="https://groups.google.com/forum/?fromgroups#!topic/knockoutjs/UTgZQNR3YgY" rel="nofollow noreferrer">here</a> but haven't been able to find a solution. </p>
  
  <p>Since I'm new to Knockout.js perhaps I'm missing something obvious? I'd like to understand why it's happening. Here's what I have:</p>
  
  <p>the form:</p>
  
  <pre><code>&lt;form data-bind="submit: Save"&gt;
   &lt;div class="span11"&gt;
  @foreach (var prop in ViewData.ModelMetadata.Properties)
  {      
    @Html.Label(prop.PropertyName, new { @class = "attribute-label" })
    @Html.TextBox(prop.PropertyName, "", new { data_bind = "value: " + prop.PropertyName + "" })
  
  }
  
  &lt;/div&gt;
  &lt;br /&gt;
  &lt;button type="submit" class="btn" data-bind="enable: IsEnabled"&gt;Update                    
  &lt;/button&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p>the viewmodel:</p>
  
  <pre><code>var viewModel = @Html.Raw(Json.Encode(Model));
  
  viewModel.Save = function() {            
  
          $.ajax({
              url: '@Url.Action("UpdateEmployee")',
              contentType: 'application/json; charset=utf-8',
              type: "POST",
              data: ko.toJSON({ employee: viewModel }),
  
              success: function(result) {
                  //...
  
              },
  
              error: function(xhr, ajaxOptions, thrownError) {
                 //...
  
              }
          });
  
      };
  
      $(function() {
  
          ko.applyBindings(viewModel);
  
      });
  </code></pre>