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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T08:57:00+00:00 2026-05-14T08:57:00+00:00

I have a WCF service that accepts requests from JQuery. Currently, I can access

  • 0

I have a WCF service that accepts requests from JQuery. Currently, I can access this service. However, the parameter value is always null. Here is my WCF Service definition:

[OperationContract]
[WebInvoke(Method = "GET", BodyStyle = WebMessageBodyStyle.WrappedRequest, RequestFormat = WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Json)]
public string ExecuteQuery(string query)
{
  // NOTE: I get here, but the query parameter is always null
  string results = Engine.ExecuteQuery(query);
  return results;
}

Here is my JQuery call:

var searchUrl = "/services/myService.svc/ExecuteQuery";
var json = { "query": eval("\"test query\"") };
alert(json2string(json));  // Everything is correct here

if (json != null) {
  $.ajax({
    type: "GET",
    url: searchUrl,
    contentType: "application/json; charset=utf-8",
    data: json2string(json),
    dataType: "json"
  });
}

What am I doing wrong? It seems odd that I can call the service but the parameter is always null. Thank you

  • 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-14T08:57:01+00:00Added an answer on May 14, 2026 at 8:57 am

    What is the json2string doing and why are you using eval? Your ExecuteQuery function takes a single string parameter named query which could be passed like this:

    $.ajax({
        url: searchUrl,
        contentType: 'application/json; charset=utf-8',
        data: { query: 'this is the query that will be sent to the service' },
        success: function(json) {
            // json.d will contain the string result returned by the web method
            alert(json.d);
        }
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a WCF service that accepts an object as a parameter that has
I have a WCF service method that accepts a List of objects. For this
I have a WCF service that can return a stream via a WebGet. This
I have a WCF service operation that accepts a data contract parameter of custom
I have a WCF chat service that accepts duplex tcp connections. A single duplex
I have written a simple WCF service that accepts and stores messages. It works
I have a WCF service that I have to reference from a .net 2.0
I have a WCF service that I call from a windows service. The WCF
I have developed a sample WCF REST service that accepts that creates an Order
My WCF Service has an OperationContract that accepts, as a parameter, an array of

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.