Skip to content Skip to sidebar Skip to footer

JQuery AJAX 'post' Data Isn't Making It Through To The Web Api Controller

I'm setting a Person() object to a couple of ko.observables and trying to pass it into my ajax call. On the other side, a web API controller its coming over as null. This is how I

Solution 1:

  public ..... Post([FromBody]objClass obj)
  var thing=obj.property;

Also you cant post an object (it needs to be real data) , see Json stringify try this thread How to JSON.stringify and JSON.parse without getting an empty object?


Solution 2:

Use ko.toJSON it will correctly serialize the observables to plain JSON data

Also you model definition is strange. To define the observables outside of the constructor, this mean that you cant have more than one instance of the Person object


Post a Comment for "JQuery AJAX 'post' Data Isn't Making It Through To The Web Api Controller"