title: Pass a single parameter to WebApi controller using jQuery Ajax
body: <p>I am trying to pass a single parameter (string value) to webapi controller but, it is not working. The parameter value is reaching the controller as 'null'. Here is my WebApi config,</p>
  
  <pre><code>public static class WebApiConfig
      {
          public static void Register(HttpConfiguration config)
          {
              config.Routes.MapHttpRoute(
                 name: "DefaultApi",
                 routeTemplate: "api/{controller}/{action}"
             );
  
          }
      }
  </code></pre>
  
  <p>Controller:</p>
  
  <pre><code>        [HttpPost]
          public HttpResponseMessage GetDataView(string request)
          { 
              try
              {
                  var result = DB.GetDataView(request);
  
                  return Request.CreateResponse(HttpStatusCode.OK, result);
              }
              catch (Exception ex)
              {            
                  //todo: log exception   
                  throw ex;
              }
          }
  </code></pre>
  
  <p>AJAX</p>
  
  <pre><code>var serverName = 'ds100';
   $.ajax({
          url: 'api/ServerInfo/GetDataView',
          type: 'POST',
          dataType: 'json',
          data: serverName,
          success: function (data, textStatus, xhr) {
  
          },
          error: function (xhr, textStatus, errorThrown) {
  
          }
  </code></pre>
  
  <p>Am I missing anything? Any help is appreciated.</p>