title: Return JSON from ASMX web service, without XML wrapper?
body: <p>I need to get Json data from a C# web service.</p>
  
  <p>I know there are several questions based on this, trust me I have read through quite a few but only to confuse me further.  </p>
  
  <p>This is what I have done :  </p>
  
  <p>In my web service I have included : <code>[System.Web.Script.Services.ScriptService]</code> for the class &amp; <code>[ScriptMethod(ResponseFormat = ResponseFormat.Json, UseHttpGet = true)]</code> for the method</p>
  
  <p>I have also used a <code>JavaScriptSerializer()</code> to convert my data to a string</p>
  
  <p>I am calling this service using <code>$.getJSON()</code></p>
  
  <p>If I don't use that I get an Cross domain reference error.</p>
  
  <p>To do this I had to setup m service to get the callback function name
  so I am passing t<code>his.Context.Request["callback"]</code> + serialized Json Data;</p>
  
  <p>But in the output I get it wrapped in  </p>
  
  <pre><code>&lt; string xmlns="http://XYZ..."&gt;  
  </code></pre>
  
  <p>The data within the tags is in the format I need</p>
  
  <p>I also tried setting content type using : <code>$.ajaxSetup({ scriptCharset: "utf-8" , contentType: "application/json; charset=utf-8"});</code>    </p>
  
  <p>But still no success.</p>
  
  <p>Addded later: I accepted frenchie's anwser beacuse I know it is the correct approach but I stil cud not get it to work... I just put the webservice &amp; website in the same domain &amp; used xml, I know it wasnt the best way, but I had spent 2 days on it &amp; could not afford to waste more.</p>