title: DataTable to Json using jquery
body: <p>I'm trying to execute a web service which returns a DataTable with the following piece of code:</p>
  
  <pre><code>$.ajax({  
      type: "POST",  
      url: url,  
      data: data,   
      contentType: "application/json; charset=utf-8",  
      dataType: "json",  
      success: function(msg) {  
          //do things  
          }  
      }); 
  </code></pre>
  
  <p>If the webservice returns a class then it works so it has nothing to do with the input paramters etc. It only fails when the web method returns a datatable (the datatable only has 2 columns and 2 rows for the test I'm doing).</p>
  
  <p>The WebService class is decorated with the [ScriptService] attribute so I thought that ASP.NET would automatically serialize the return value as JSON. It doesn't seem to work with datatable.</p>
  
  <p>The only solution I've found was to return a string (a manually JSON serialized object) but it doesn't seem right to me to do it this way.<br>
  I'm using Visual Studio 2008 with .Net 3.5</p>