jquery ajax call return JSON parsing error
With WCF 4.0, you can add an attribute called automaticFormatSelectionEnabled
which allows the service to look at the Accept
header in the HTTP request to determine what format to return. As long as what you are returning is serializable, WCF will handle the correct serialization for you. In your jQuery ajax call, the Accept header is added by including accepts: {json: "application/json"}
.