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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T15:27:00+00:00 2026-05-27T15:27:00+00:00

I have added a service reference to my asp.net web application (originally it was

  • 0

I have added a service reference to my asp.net web application (originally it was just a straight html site and we converted it to a web application)

We need to access a WCF service via jquery/ajax and not from within any .cs files. So far we haven’t been able to get jquery to hit the service by any means, even before it was converted to a web app (converted in hopes that it would be easier to add service reference and call it)

I have the WCF service running in a separate solution running on my desktop and the web app open separately. My service is called SchoolService and is located in the Service References folder.

How in jquery do I call that service reference?

This is what we used from a demo that also did not work:

<script type="text/javascript">
    $(document).ready(function () {
        var schoolsCache = {}, lendersCache = {}, schoolsXhr, lendersXhr;

        $('#Schools').autocomplete({
            source: function (request, response) {
                var term = request.term;
                if (term in schoolsCache) {
                    response(schoolsCache[term]);
                    return;
                }
                if (schoolsXhr != null) {
                    schoolsXhr.abort();
                }
                schoolsXhr = $.getJSON('SchoolService.svc/GetSchools', request, function (data, status, xhr) {
                    schoolsCache[term] = data.d;
                    if (xhr == schoolsXhr) {
                        response(data.d);
                        schoolsXhr = null;
                    }
                });
            }
        });
     });
</script>

I have also tried this line which did not work:

schoolsXhr = $.getJSON('http://localhost:8000/SchoolService/GetSchools', request, function (data, status, xhr) {

Here is the interface in my WCF sdervice:

using System.Collections.Generic;
using System.ServiceModel;
using System.ServiceModel.Web;
using MyApp.DomainModel;

namespace MyAppService
{
        [ServiceContract]
        public interface ISchoolService
        {
                [OperationContract]
                [WebGet(ResponseFormat = WebMessageFormat.Json)]
                IList<School> GetSchools(string term);

                [OperationContract]
                [WebGet(ResponseFormat = WebMessageFormat.Json)]
                School GetSchool(string schoolName);
        }
}

What are the necessary specific steps needed to make this work? The goal is to let user type into textbox, use jquery autocomplete, which uses the ajax call to service to pull back data that contains the typed text… surely this has been done before?

CD

  • 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-27T15:27:01+00:00Added an answer on May 27, 2026 at 3:27 pm

    No one was able to answer this but we figured it out. It had nothing to do with jsonp or cross domain.

    The call from javascript makes a $.getJSON call to the url. The url is the relative url to a .svc file in the project. The .svc file is nothing more than a passthru which constructs a connection to the referenced service and makes the call and then returns back to the ajax call.

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

Sidebar

Related Questions

We have a legacy ASP.NET web site (not web application, so I can freely
I have added reference to WCF Service in my client asp.net website. Right now,
I added an AjaxToolkit:AutoCompleteExtender to my ASP.Net 3.5 application. The web service lives in
I have added a WCF service to an existing ASP.Net web project on our
In Visual Studio 2010, I have a web service reference added. In the app.config,
My team and I have a asp.net web forms application and are using several
I am doing smoke testing in my existing asp.net web application, I have developed
I have a WCF service running, I added a reference to the service by
I have a web service that I want to access when it is added
I have added a service reference to my visual studio project, and now I

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.