title: Consuming the data returned from a jQuery AJAX call to a WCF Service
body: <p>Created a very simple WCF function that returns a string.</p>
  
  <pre><code>public interface IDataService
  {
      [OperationContract]
      [WebInvoke( Method = "POST", BodyStyle = WebMessageBodyStyle.Wrapped, ResponseFormat = WebMessageFormat.Json )]
      string DoWork( );
  }
  
  [AspNetCompatibilityRequirements( RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed )]
  public class DataService : IDataService
  {
      public string DoWork( )
      {
          return "DONE";
      }
  }
  </code></pre>
  
  <p>I call it using jQuery.ajax:</p>
  
  <pre><code>$.ajax({
      type: "POST",
      url: service + "/DoWork",
      data: "{}",
      contentType: "application/json; charset=utf-8",
      dataType: "json",
  
      success: function (data, textStatus, jqXHR) {
          alert(textStatus);       --&gt; success
          alert(data);             --&gt; object
          alert(data.d);           --&gt; undefined
      },
  
      error: function (jqXHR, textStatus, errorThrown) {
          alert(textStatus + " : " + errorThrown);
      }
  });
  </code></pre>
  
  <p>The function returns successfully. </p>
  
  <p><code>textStatus</code> displays <strong>success</strong>.</p>
  
  <p><code>data</code> displays <strong>object</strong>.</p>
  
  <p><code>data.d</code> is <strong>undefined</strong>.</p>
  
  <p>How do I get the string returned from DoWork?</p>