Author: slikrik | Posted on: 2/26/2009 10:42:59 AM | Views : 276

Greetings,

I am attempting to write a self-hosted WCF service in my managed C# program that will be accessed via jQuery from another website.  I created the web service the standard way (using the wizard) and it works great when I *call* the service from my website the standard way (in the C# ASP.NET code-behind file).

However, I want to be able to call it from jQuery, and preferably with JSON instead of XML.  So not expecting much, I added the following function to my client-side javascript:

  function CallService() {
$.ajax({
type: "POST",
url: "http://localhost:8731/Design_Time_Addresses/TradeServer/MyService/",
data: "{}",
contentType: "application/json; charset=utf-8",
dataType: "json",
...

Go to the complete details ...