title: jQuery ajax call failing with undefined error
body: <p>My jQuery ajax call is failing with an <em>undefined</em> error. My js code looks like this:</p>
  
  <pre><code>$.ajax({
     type: "POST",
     url: "Data/RealTime.ashx",
     data: "{}",
     contentType: "application/json; charset=utf-8",
     dataType: "json",
     timeout: 15000,
     dataFilter: function(data, type) {
         alert("RAW DATA: " + data + ", TYPE: "+ type);
         return data;
     },
     error: function(xhr, textStatus, errorThrown) {
         alert("FAIL: " + xhr + " " + textStatus + " " + errorThrown);
     },
     success: function(data) {
         alert("SUCCESS");
     }
  });
  </code></pre>
  
  <p>My ajax source is a generic ASP.NET handler:</p>
  
  <pre><code>[WebService(Namespace = "http://my.website.com")]
  [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
  public class RealTime : IHttpHandler
  {
      public void ProcessRequest(HttpContext context)
      {
          context.Response.ContentType = "application/json";
          context.Response.Write("{ data: [1,2,3] }");
          context.Response.End();
      }
  
      public bool IsReusable
      { get { return false; } }
  }
  </code></pre>
  
  <p>Now, if I return an empty object (<code>"{ }"</code>) in my handler, the call will succeed. But when I return any other JSON object, the call fails.</p>
  
  <p>The <code>dataFilter</code> handler shows that I am receiving a correct object. Firebug shows the response as expected, and the JSON tab shows that the object is parsed correctly.</p>
  
  <p>So what could be the cause?</p>
  
  <p><strong>[Edit]</strong> I should have actually written "when I return any <em>invalid</em> JSON object, the call fails"! :D</p>