title: WCF - "Encountered unexpected character 'c'."
body: <p>I am trying to do something that I thought would be simple. I need to create a WCF service that I can post to via JQuery. I have an operation in my WCF service that is defined as follows:</p>
  
  <pre><code>[OperationContract]
  [WebInvoke(Method = "POST", BodyStyle = WebMessageBodyStyle.WrappedRequest, RequestFormat=WebMessageFormat.Json, ResponseFormat=WebMessageFormat.Json)]
  public string SendMessage(string message, int urgency)
  {
    try
    {
      // Do stuff
      return "1";  // 1 represents success
    }
    catch (Exception)
    {
      return "0";
    }
  }
  </code></pre>
  
  <p>I then try to access this operation from an ASP.NET page via JQuery. My JQuery code to access this operation looks like the following:</p>
  
  <pre><code>function sendMessage(message) {
    $.ajax({
      url: "/resources/services/myService.svc/SendMessage",
      type: "POST",
      contentType: "application/json; charset=utf-8",
      data: ({ message: message, urgency: '1' }),
      dataType: "json",
      success: function (data) {
        alert("here!");
      },
      error: function (req, msg, obj) {
        alert("error: " + req.responseText);
      }
    });
  }
  </code></pre>
  
  <p>When I execute this script, the error handler is tripped. In it, I receive an error that says: </p>
  
  <p>"Encountered unexpected character 'c'."</p>
  
  <p>This message is included with a long stack trace. My question is, what am I doing wrong? I have received other posts such as this one (<a href="https://stackoverflow.com/questions/320291/how-to-post-an-array-of-complex-objects-with-json-jquery-to-asp-net-mvc-controll">How to post an array of complex objects with JSON, jQuery to ASP.NET MVC Controller?</a>) without any luck. How do I get this basic interaction working?</p>
  
  <p>Thank you!</p>