title: Send data to webapi GET Request Ajax call
body: <p>I have below model class in webapi :-</p>
  
  <pre><code>public class SampleClass
      {
          public int id { get; set; }
          public string Name { get; set; }
      }
  </code></pre>
  
  <p>Get method in Controller :- </p>
  
  <pre><code>public string Get([FromBody]SampleClass sample)
          {
              return "value";
          }
  </code></pre>
  
  <p>I am calling this Get method from application through ajax call as:-</p>
  
  <pre><code>var source = {
                  'id': 0,
                  'Name': 'sagar'
              }            
  
              $.ajax({
                  type: "GET",
                  dataType: "json",
                  url: "http://localhost:51366/api/Values",
                  data: source,
                  success: function (data) {
                      alert(data);
                  },
                  error: function (error) {
  
                      jsonValue = jQuery.parseJSON(error.responseText);
                      alert("error" + error.responseText);
                  }
              });
  </code></pre>
  
  <p>Method gets called but SampleClass object obtained is null
  But I have sent id as 0 and Name as sagar. It should retrieve these values instead null.</p>
  
  <p><a href="https://i.stack.imgur.com/XTx4K.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/XTx4K.jpg" alt="enter image description here"></a></p>