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 7174329
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T16:00:58+00:00 2026-05-28T16:00:58+00:00

I have been having some issues retrieving JSON data from a WCF service application

  • 0

I have been having some issues retrieving JSON data from a WCF service application I have created. I have a simple WCF service which returns the following JSON:

[{"RoomId":1,"RoomName":"Big Room"},{"RoomId":2,"RoomName":"Medium Room"},{"RoomId":3,"RoomName":"Small Room"}]

I am trying to access this data from a web application using JQuery. I have tried various JQuery statements to try and retrieve the data but nothing appears. The following is my most current attempt:

$(function () {
    $.getJSON('http://localhost:6188/RoomBookingService.svc/GetRooms?callback=Rooms', function (data) {
        alert(data);
    });

The following is my WCF service application code:

[ServiceContract]
public interface IRoomBookingService
{
    [OperationContract]
    [WebGet(BodyStyle = WebMessageBodyStyle.Bare,ResponseFormat = WebMessageFormat.Json, UriTemplate = "GetRooms")]

    Room[] GetRooms();

Config:

<?xml version="1.0"?>
<configuration>
  <system.web>
    <compilation debug="true" targetFramework="4.0" />
  </system.web> 
  <system.serviceModel>
    <services>
      <service name="RoomBookingServices.RoomBookingService" behaviorConfiguration="RoomBookingServiceBehaviour">
        <endpoint address="" binding="webHttpBinding" bindingConfiguration="webHttpBindingWithJsonP" contract="RoomBookingServices.IRoomBookingService" behaviorConfiguration="webHttpBehavior">
        </endpoint>
      </service>
    </services>
    <behaviors>
      <serviceBehaviors>
        <behavior name="RoomBookingServiceBehaviour">
          <!-- To avoid disclosing metadata information, set the value below to false and remove the metadata endpoint above before deployment -->
          <serviceMetadata httpGetEnabled="true"/>
          <!-- To receive exception details in faults for debugging purposes, set the value below to true.  Set to false before deployment to avoid disclosing exception information -->
          <serviceDebug includeExceptionDetailInFaults="true"/>
        </behavior>
      </serviceBehaviors>      
      <endpointBehaviors>
        <behavior name="webHttpBehavior">
         <webHttp/>
        </behavior>
      </endpointBehaviors>
    </behaviors>
    <bindings>
      <webHttpBinding>
        <binding name="webHttpBindingWithJsonP" crossDomainScriptAccessEnabled="true" />
      </webHttpBinding>
    </bindings>  
    <!--<serviceHostingEnvironment multipleSiteBindingsEnabled="true" />-->
  </system.serviceModel>
  <system.webServer>
    <modules runAllManagedModulesForAllRequests="true"/>
  </system.webServer>
</configuration>

All I need the JQuery to do is return the JSON and display it in a div tag or something, as later it will be formatted. Any help would be great.

Thanks in advance.

  • 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-05-28T16:01:00+00:00Added an answer on May 28, 2026 at 4:01 pm

    I belive that in typical usages of jsonp calls with WCF, the callback parameter is assigned as a question mark.

    $(function () {
        $.getJSON('http://localhost:6188/RoomBookingService.svc/GetRooms?callback=?', function (data) {
           alert(data);
    });
    

    Then the jQuery getJSON method will replace the question mark with a dynamically-generated javascript function to handle the JSONP callback

    See this article for further details.

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

Sidebar

Related Questions

I have been having some issues with LINQ-To-SQL around memory usage. I'm using it
I have been having some major issues with my Visual Studio 2008 Pro install.
I have been having some issues with django-haystack and need some help. I run
Ok, I have been searching thick and thin, and I am having some issues
I have some utility methods that use Microsoft.Web.Administration.ServerManager that I've been having some issues
I have downloaded the Kohana Pagination module from Git and have been having some
I am having some issues with Android market statistics as they have not been
Having some issues accessing my param tags from within actionscript. Essentially I have the
I have been having some problems trying to get my PHP running. When I
We have been having some debate this week at my company as to how

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.