Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8355029
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T09:44:09+00:00 2026-06-09T09:44:09+00:00

I built a WCF service which produces JSON. I want to make an external

  • 0

I built a WCF service which produces JSON. I want to make an external website which uses this webservice. For now I am executing the WCF service over LAN by IIS, so I can connect to the service by going to http://myownaddress/blabla.svc/

I tried to learn some json and to get some results from my service.

For example if I want to use this method:

        [OperationContract]
        [WebInvoke(Method = "GET",
            ResponseFormat = WebMessageFormat.Json,
            BodyStyle = WebMessageBodyStyle.Wrapped,
            UriTemplate = "json/{id}")]
        string JSONData(string id);

I’ll go to http://myownaddress/blabla.svc/json/123
And as result I get:
{“JSONDataResult”:”You requested product 123″}

Now I have tried to receive this result with the JQuery statement getJSON. But I don’t see any results.

My question is how can I get this simple data?

And secondly how can I post data(with javascript) back on to the wcf service is it also possible with json?

-edit-:

I have now updated my code and put this into my document ready function which is located between the <head> <script> …. on my page:

$.getJSON(
           'http://myownaddress/blabla.svc',
            function(data) 
            {
               alert(data.JSONDataResult);
            });

But this won’t give the alert with the result. It doesn’t even give an alert.. Besides that, in the function I need to give a parameter of id, so for example 123 (look in text above) don’t I need to put that in the function also?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T09:44:12+00:00Added an answer on June 9, 2026 at 9:44 am

    To get data use getJSON():

    $.getJSON(
        'http://myownaddress/blabla.svc/',
        function(data) {
            alert(data.JSONDataResult);
        }
    );
    

    To post data you can use this:

    $.post('http://myownaddress/postservice.svc', function(data) {
      $('.result').html(data);
    });
    

    or this (if you need more control):

    $.ajax({
      type: 'POST',
      url: url,
      data: data,
      success: success,
      dataType: dataType
    });
    

    You can also use the ajax for getting the data instead of the getJSON method .

    UPDATE:

    try using ajax method as it gives you more control:

     $.ajax({
          type: 'GET',
          url: "http://myownaddress/blabla.svc/json/123",
          success: function(data){alert(data)},
          dataType: "json",
          complete: function(data){alert(data)},
          error: function(jqXHR, textStatus, errorThrown){alert(errorThrown)}
        });
    

    Also, if you use firefox, check out firebug extension, it will help you greatly.
    If you use chrome then use chrome developer tools.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Here's the background: I built a new WCF service which uses EF5 and was
I have written a .NET Windows service which has a WCF service built into
I wanted to know, when WebGet/WebInvoke requests are made in WCF service which built-in
I've recently built a WCF service and am now ready to add security to
I have built up the wcf web service in visual studio express 2010. I
I am developing a WCF service on my local computer using Visual Studios built
Is there any way to replace the WCF service application built-in JavascriptSerializer with Newtonsoft
I've built a WCF Publish Subscribe Topic Service and can successfully publish/subscribe with a
I'm trying to build a Rest JSON service with the WCF REST Service Template
I have a WCF Service contract which is basically the Publish Subscriber pattern. The

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.