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

  • Home
  • SEARCH
  • 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 6744509
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T12:05:33+00:00 2026-05-26T12:05:33+00:00

When I post my ajax data to my webservice I keep getting this error.

  • 0

When I post my ajax data to my webservice I keep getting this error. I have tried many times and changed my code to return a json string back but it fails every time.All im trying to do is send back the data I have posted so I know it works. I have looked for answers and I have tried other alternatives but im not getting the results here is the error

{“Message”:”Invalid web service call, missing value for parameter: \u0027filters\u0027.”,”StackTrace”:” at System.Web.Script.Services.WebServiceMethodData.CallMethod(Object target, IDictionary2 parameters)\r\n at System.Web.Script.Services.WebServiceMethodData.CallMethodFromRawParams(Object target, IDictionary2 parameters)\r\n at System.Web.Script.Services.RestHandler.InvokeMethod(HttpContext context, WebServiceMethodData methodData, IDictionary`2 rawParams)\r\n at System.Web.Script.Services.RestHandler.ExecuteWebServiceCall(HttpContext context, WebServiceMethodData methodData)”,”ExceptionType”:”System.InvalidOperationException”}

jquery:

data = [{'Name': 'Acer', 'Count': 1 }, {'Name': 'HP', 'Count': 2 }]
function getProducts(json, pageIndex, pageSize) {

    $.ajax({
        type: 'POST',
        url: '/website2/WebServices/GetProducts.asmx/GetProductsAndFilters',
        data: "{'data' : {'filters':" + JSON.stringify(json) + ", 'PageIndex' : " + pageIndex + ", 'PageSize' : " + pageSize +  "}}",
        contentType: 'application/json; charset=utf-8',
        dataType: 'json',
        success: function (responseText) {
            //alert(responseText.d);
            $('.console').html(responseText.d);
        },
        error: function (xhr, status, error) {
            //var msg = JSON.parse(xhr.responseText);
            //alert(msg.Message);
            $('.console').html(xhr.responseText)
        }
    });
}
getProducts(data, "0", "2")

C#:

public class dvals
{
    public string Name { get; set; }
    public string Count { get; set; }
}

public class data
{
    public List<dvals> Filters {get;set;}
    public string PageIndex { get; set; }
    public string PageSize { get; set; }
}

[WebMethod]
[ScriptMethod(ResponseFormat = ResponseFormat.Json)]
public data GetProductsAndFilters(data filters)
{
    JavaScriptSerializer js = new JavaScriptSerializer();
    //List<dvals> json = js.Deserialize<List<dvals>>(filters);
    //data json = js.Deserialize<data>(filters);
    var fname = "";
    /*
    foreach (var filter in filters)
    {
        if (filter.Name == "Acer")
        {
            fname = filter.Name;
            break;
        }

    }*/
    return filters; 
}
  • 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-26T12:05:33+00:00Added an answer on May 26, 2026 at 12:05 pm

    ASP.NET will handle the JSON [de]serialization for you automatically. Change your server-side method to match the type of data you’re passing in from the client-side.

    edit: And as Jon pointed out, your data parameter’s property key needs to match the WebMethod’s input parameter name (this is case-sensitive even).

    [WebMethod]
    [ScriptMethod(ResponseFormat = ResponseFormat.Json)]
    public List<dvals> GetProductsAndFilters(List<dvals> dvals)
    {
      // Do what you need to with "filters" here.
    
      return filters;
    } 
    

    Also, where is the json variable in your JSON.stringify() call defined? It looks like that should be data, given the code you’ve shown us.

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

Sidebar

Related Questions

I have ajax request to post data to asmx webservice, how will i post
$.ajax({ type: POST, url: WebService.asmx/AddVisitor, data: {'fname':'dave', 'lname':'ward'}, contentType: application/json; charset=utf-8, dataType: json });
I have a AJAX post method that gets xml data from server. But when
.ajax({ type: 'POST', url: '..serverices/ajaxserver.asmx', data: 'lname='+ $('#lastname').val() }); return false; if #lastname has
I always see the code like this in the blogs: $.ajax({ type: POST, contentType:
How to call webservice through jquery... I tried following code.. $(document).ready(function() { $(#sayHelloButton).click(function(event){ $.ajax({
I have created a code like this to access method AddNums in my webservice.
I have the following code which is trying to post xml constructed data to
I have the following ajax call to webservice to pass json data and get
When my PHP script receives data from an AJAX POST request, the $_POST variables

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.