title: Knockoutjs is calling a REST API Post twice
body: <p>I am working on an ASP.NET MVC application using knockoutjs for MVVM. I when trying to make a Post to an ASP.NET Core API, the request from knockout seems to be posting 2 times. Below is the knockoutjs viewModel</p>
  <pre><code>var viewModel = function () {
      var self = this;
      self.Surname = ko.observable(&quot;&quot;).extend({ required: { message: 'Please supply your surname' } });
      self.Firstname = ko.observable(&quot;&quot;).extend({ required: { message: 'Please supply your firstname' } });
      self.Middlename = ko.observable(&quot;&quot;);
      self.Title = ko.observable().extend({ required: true });
       
      self.save = function () {
         
              $.ajax({
                  contentType: 'application/json',
                  url: 'https://localhost:44337/api/Student/SaveStudent',
                  type: 'post',
                  data: ko.toJSON(self),
                  dataType: &quot;json&quot;,
                  processData:false;
                  success: function (data) {
                      alert(data);
                      
                  },
                  error: function (err) {
                      alert(err.status + &quot; : &quot; + err.statusText);
                      self.Kill(false);
                  }
                  
              });
          }
  
      }
      
  }
  ko.applyBindings(new viewModel());
  
  [HttpPost]
          public IActionResult SaveStudent(StudentDTO student)
          {
              var st = _studentService.SaveStudent(student);
               
              return Ok(st);
          }
  </code></pre>
  <p>On save, the API is hit twice, first hit returns a status 204 and the second says:&quot;request fail&quot;.
  But If i call same API using postman it executes successfully without any error</p>