title: Calling WCF service with jquery and parameters
body: <p>Ok, this is one of these basic questions, but I've googled and debugged now for two hours and the error escapes me. </p>
  
  <p>Simple scenario: WCF service with methods with parameters which I'd like to call through jquery. I can call methods without params alright, but with params, the call never makes it to my breakpoint in .NET. </p>
  
  <p>ServerCode: </p>
  
  <pre><code>[ServiceContract(Namespace = "http://www.myhost.de")]
  [AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)]
  public class MyService
  {
      [OperationContract]
      public int TestMeWithParam(int lastId)
      {
          return lastId;
      }
  
      [OperationContract]
      public int TestMe()
      {
          return 5;
      }
  }
  </code></pre>
  
  <p>Javascript code</p>
  
  <pre><code>function BaseServiceCall(serviceName, dataInput, successCB, errorCB) {
      $.ajax({
          type: "POST",
          contentType: "application/json; charset=utf-8",
          url: BaseUrl + "Services/MyService.svc/" + serviceName,
          data: dataInput,
          dataType: "json",
          timeout: 2000,
          success: successCB,
          error: errorCB
      });
  }
  
  function ServiceGetMessages(lastMessageId, successCB, errorCB) {
      BaseServiceCall("TestMeWithParam", "{'lastId':'17'}", successCB, errorCB);
      //BaseServiceCall("TestMe", "", successCB, errorCB);
  }
  </code></pre>
  
  <p>So, if I call the TestMe service it returns 5. It works. TestMeWithParam never gets called.</p>
  
  <p>What's going on?</p>