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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T21:59:02+00:00 2026-06-04T21:59:02+00:00

Thou there a dozen posts that cover how to call WCF methods from jQuery,

  • 0

Thou there a dozen posts that cover how to call WCF methods from jQuery, I can’t make it work. I have simple WCF service application

[ServiceContract]
public interface IService1
{

    [OperationContract]
    [WebInvoke(Method = "GET", BodyStyle = WebMessageBodyStyle.WrappedRequest, RequestFormat = WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Json)]
    string GetData(int value);

 }

This is the implementation

[AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)]
public class Service1 : IService1
{

    public string GetData(int value)
    {
        return string.Format("You entered: {0}", value);
    }
}

And this is the web.config of my service

<system.serviceModel>
<behaviors>
  <endpointBehaviors>
    <behavior name="TestWebApp.Service1AspNetAjaxBehavior">
      <enableWebScript />
    </behavior>
  </endpointBehaviors>
  <serviceBehaviors>
    <behavior name="TestWebApp.Service1AspNetAjaxBehavior">
      <serviceMetadata httpGetEnabled="true" />
      <serviceDebug includeExceptionDetailInFaults="true"/>
    </behavior>
  </serviceBehaviors>
</behaviors>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true"
  multipleSiteBindingsEnabled="true" />
<services>
  <service name="jQueryToWCF.Service1">
    <endpoint address="" 
              behaviorConfiguration="TestWebApp.Service1AspNetAjaxBehavior"
              binding="webHttpBinding" 
              contract="jQueryToWCF.IService1" />
  </service>
</services>

Now I’m trying to call this from jQuery ( from html page )

$(document).ready(function () {
        var param = "{value: 'Hello World!'}";
        $.ajax({
            type: "GET",
            url: "http://localhost:5555/Service1.svc/GetData",
            data: param,
            contentType: "application/json; charset=utf-8",
            dataType: "json",
            success: function (result) {
                alert(result.d);
            }
        });
    });

But no call even makes to Service. I checked it up by Fiddler. But when I’m puting the url into browser, I can get the response. Can anybody help me to figure this out ?

  • 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-04T21:59:03+00:00Added an answer on June 4, 2026 at 9:59 pm

    I’ve been struggling off and on with this for awhile.

    The page that finally got me moving was this one: http://forums.asp.net/t/1765610.aspx/1

    Meanwhile: Here is a functional project file that should work. You may need to replace the url in the javascript to be the correct port #.

    http://submissiv.com/share/playground.wcf.service.zip

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

Sidebar

Related Questions

Brainstorming needed . I have a problem with Javascript libraries (jQuery, ExtJS etc.) that
Python date calculations, where art thou? I have a python app that needs to
One of my C++ classes derives from std::vector so that it can act as
I have to parse some numbers from file names that have no common logic.
I was wondering if anyone knows of rubyzip alternatives for Ruby, that can handle
Let me first describe the problem. I have this application that opens a word
Wondering what are the views on this We have a CI server that runs
I have two applications that play video. in one of them the JWplayer plays
In Access 2007, I have two tables related such that the (surrogate) PK of
I am trying to write an awk script that can get a block that

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.