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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T10:03:36+00:00 2026-05-16T10:03:36+00:00

I have a web method in one of my aspx pages: [WebMethod] public static

  • 0

I have a web method in one of my aspx pages:

[WebMethod]
public static string AddDebt(int userId, int type, string description, float amount)

And in the aspx page I have the JQuery

$(".addDebt").click(function (e) {
            e.preventDefault();
            var userId = $("[id$='txtUserId']").val();
            var type = $("[id$='ddlExistingDebtType']").val();
            var description = $("[id$='txtExistingDebtLender']").val();
            var amount = $("[id$='txtExistingDebtAmount']").val();

            var results = new Array();
            results.push({ userId: userId });
            results.push({ type: type });
            results.push({ description: description });
            results.push({ amount: amount });
            var dataString = JSON.stringify(results);
            $.ajax(
            {
                type: "POST",
                url: "register_borrower_step4.aspx/AddDebt",
                data: dataString,
                contentType: "application/json; charset=utf-8",
                dataType: "json",
                success: function (result) {
                    $(".pDebtsTable").text(result);
                }
            });

        });

I know that looks stupid the way I have set the data param but it was cleaner before and I will change it, but the point is, the JSON seems fine to me so it isn’t that?

When it is run there is not post to the web method, though if I change contentType and dataType I get the whole aspx page returned. One thing I just thought of, say this jquery is actually on the register_borrower_step4.aspx page, would that cause a problem?

  • 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-16T10:03:37+00:00Added an answer on May 16, 2026 at 10:03 am

    The method doesn’t expect an array. Try like this:

    var dataString = JSON.stringify({ 
        userId: userId, 
        type: type, 
        description: description, 
        amount: amount 
    });
    
    $.ajax({
        type: "POST",
        url: "register_borrower_step4.aspx/AddDebt",
        data: dataString,
        contentType: "application/json; charset=utf-8",
        dataType: "json",
        success: function (result) {
            $(".pDebtsTable").text(result);
        }
    });
    

    Also make sure that floating point separator is correct according to the culture for the amount parameter. Make the distinction between . and , or the web method might not work. To further analyze any problems you could use FireBug to see exactly what is happening under the covers.

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

Sidebar

Related Questions

I have a simple web service operation like this one: [WebMethod] public string HelloWorld()
If I have a web service method, e.g. [WebMethod] [XmlInclude(typeof(SportsCar)), XmlInclude(typeof(FamilyCar))] public Car[] GetCars()
i have a simple asmx page with one web method which return array of
I have a functional page posting data to a Page WebMethod [WebMethod()] public static
I have written a sample web service, which consist of certain .aspx pages. I
I have a web service (ASMX) and in it, a web method that does
I have a problem with a oneway web method that open a moss site
Say I have an ASMX web service, MyService. The service has a method, MyMethod.
I currently have this working but it requires me to have a static method
I have two pages, the parent and from this page I am using: window.open('OrderDetailsFull.aspx?ObjectID='

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.