title: Ajax query using Jquery to ASP.NET webservice giving "Bad Request" only for methods with parameters
body: <p>I am having issues calling an ASP.NET web service in JQuery. I am basically following all the instructions on:</p>
  
  <p><a href="http://www.codeproject.com/Articles/211489/Using-JSON-with-ASP-NET-3-5" rel="nofollow">http://www.codeproject.com/Articles/211489/Using-JSON-with-ASP-NET-3-5</a></p>
  
  <p>I have written the Web service and the console server in C# and ASP.NET.</p>
  
  <p>My JQuery is as follows:</p>
  
  <pre><code>    jQuery.support.cors = true;
  $.ajax({
      type: "POST",
      contentType: "application/json; charset=ut-8",
      username: "John",
      password: "Doe",
      url: "https://machinename:8043/WtfService/HelloWorldPostSimple1",
      data: '{"firstName":"John"}',
      dataType: "json",
      success: function(msg) {
          alert(msg.d);
      },
      error: function(jqXHR, textStatus, errorThrown) {
          alert(jqXHR + " : " + textStatus + " : " + errorThrown);
      }
  });
  </code></pre>
  
  <p>The first line allows for cross domain calls in IE which works. If I call a web service method that doesn't accept parameters, it works 100% for GET and POST.</p>
  
  <p>My web service method is as follows:</p>
  
  <pre><code>[WebInvoke(Method = "POST", UriTemplate = "HelloWorldPostSimple1")]
  [PrincipalPermission(SecurityAction.Demand, Role = "WtfUser")]
  public string HelloWorldPostSimple1(string firstName)
  {
      return string.Format("Hello {0} {1}", firstName, "Doe");
  }
  </code></pre>
  
  <p>I've tried specifically putting in the Request and Response formats as JSON but still no luck.</p>