I have the piece of code below of a template Ajax enabled WCF service. What can i do to make it return JSon instead of XML? thanks.
using System;
using Sys
Have you tried:
[WebGet(ResponseFormat= WebMessageFormat.Json)]
If you want to use the POST verb as in $.ajax({ type: "POST", ...) you will need to markup your method with [WebInvoke(Method="POST"].
Since you marked it up with [WebGet] (which is equivalent to [WebInvoke(Method="GET")]) you should call the service using the GET verb, e.g.:
$.ajax({ type: "GET", ...) or use $.get(url, data, ...) (see jQuery.get for more info).
And you'll need to set the ResponseFormat to Json, as tomasr already pointed out.