Here is the another way to go around:
[OperationContract]
[WebGet(UriTemplate = "/GetUserDetails/{strUserID}",
ResponseFormat = WebMessageFormat.Json)]
User GetUserDetails(string strUserID);
And User
is your custom class holding detail.
[DataContract]
public class User
{
[DataMemeber]
public in UserID {get; set;}
// Remaining attributes here.
}
I don't have much experience with AJAX but I think it should work.
url: 'http://<ipaddress>/WcfService1/Service1.svc/GetUserDetails/101'
type: 'GET',
//contentType: "application/json; charset=utf-8", No need to mention it for GET