title: Typescript Jquery post object
body: <p>I'm trying to send a TypeScript class with the jQuery post method. And everything is working well, but there is one point I'm trying to fix.</p>
  
  <p>Lets say i got the model below.</p>
  
  <pre><code>export class TestModel{
      private id: string;
      private username: string;
  
      constructor(id: string, username: string) {
          this.id= loginName;
          this.username= password;
      }
  
      IsValid(): boolean {
          return true;
      }
  }
  </code></pre>
  
  <p>And to post it i got this function:</p>
  
  <pre><code>var testModel = new TestModel("test1", "test2");
      $.ajax({
           url: "MyUrl",
           type: "POST",
           data: testModel,
       });
  </code></pre>
  
  <p>When I look to the network request the folowing information is post:</p>
  
  <pre><code>id: test1
  username: test2
  IsValid: true
  </code></pre>
  
  <p>The only things i want to post is the id and username, the IsValid method is only to validate this model, like are all fields filled in, when it's an email field check an email filled in etc.</p>
  
  <p>So my question is, what is the solution to only send the id and username, without any other functions? (if this is possible ofcourse :)).</p>
  
  <p>Thanks for your help,
  Stefan</p>