Click here to Skip to main content
11,634,622 members (66,340 online)
Rate this: bad
Please Sign up or sign in to vote.
See more: C# Javascript WCF jQuery , +
This is the WCF Service code:

        [WebGet(RequestFormat = WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Json, BodyStyle = WebMessageBodyStyle.Bare)]
        public String GreetJson()
            Greeting g = new Greeting();
            g.Message = "Hello World!";
            Console.WriteLine("call received");
            JavaScriptSerializer serializer = new JavaScriptSerializer();
            return serializer.Serialize(g); ;

and the client request:
                alert("test=" + data);
<img src="data/images/menu/highscore.png" alt="Highscore" id="test" />

if we use in a browser we get:
"{\"Message\":\"Hello World!\"}"

Our problem is that we don't receive any response from the server when we do getJSON request.

Console.WriteLine("call received"); //the message appears in the console but on the browser there is no alert box.
Any idea why?
Posted 8-Apr-12 4:15am

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 OriginalGriff 8,736
1 Sergey Alexandrovich Kryukov 8,419
2 Mika Wendelius 6,845
3 F-ES Sitecore 2,354
4 Suvendu Shekhar Giri 2,205

Advertise | Privacy | Mobile
Web04 | 2.8.150728.1 | Last Updated 8 Apr 2012
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100