title: Web API Ajax calling not working
body: <p>Here is my js code to call custom web api method.. </p>
  
  <pre><code>$.ajax({
          url: '/api/AdminAPI/IndustryPost/?industryName='+addNewIndustryName,
          type: 'Post',
          cache: false,
          contentType: 'application/json; charset=utf-8',       
          success: function (response) {
             // response code.
          }
      });
  </code></pre>
  
  <p>this is working fine but in case i am using 'data' tag to send data, its not working. like THE FOLLOWING.</p>
  
  <pre><code> $.ajax({
          url: '/api/AdminAPI/IndustryPost',
          type: 'Post',
          cache: false,
          contentType: 'application/json; charset=utf-8',
          data: { 'industryName': addNewIndustryName },
          success: function (response) {
             // response code.
          }
      });
  </code></pre>
  
  <p>WebApiConfig is config.MapHttpAttributeRoutes();</p>
  
  <pre><code>        config.Routes.MapHttpRoute(
               name: "DefaultApi",
               routeTemplate: "api/{controller}/{action}/{id}",
               defaults: new { id = RouteParameter.Optional }
          );
  </code></pre>
  
  <p>here is my api method</p>
  
  <pre><code>    [ActionName("IndustryPost")]
      public void AddIndustry(string industryName)
      {
          //code here
      }
  </code></pre>
  
  <p>While testing with fiddler second code request result to 404 error. While accessing web API method directly from URL works fine.</p>
  
  <p>Answer::</p>
  
  <p>After doing R'N'D on this topic i came to know that there is a issue in web API parameter binding. So, what either we can use [formUri] tag or we can have a model class. like this</p>
  
  <p>public class IndustryName
      {
          public string Industryname { get; set; }
      }</p>
  
  <p>and in web api method </p>
  
  <p>public void IndustryPost(IndustryName industryName)
          {
              // 
          }</p>
  
  <p>No change needed in jquery.</p>
  
  <p>Here this article explain it all 
  <a href="https://stackoverflow.com/questions/20815268/post-int-as-part-of-method-but-get-no-http-resource-was-found-that-matches-the-r">Post int as part of method but get No HTTP resource was found that matches the request URI error</a></p>