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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T03:02:07+00:00 2026-05-19T03:02:07+00:00

I have a web Method in my C# that is called via Jquery ajax

  • 0

I have a web Method in my C# that is called via Jquery ajax method. The web method should return an object back to the Jquery which will be used to populate.

I have tried returning a JsonResult object, the actual object and nothing seems to work! I’m not using MVC (Unfortunately). Is there a way that I can return an object from my web method which can be used by my AJAX method?

here is the link for my JQuery AJAX method

http://pastebin.com/tRSaY5rG

http://pastebin.com/WajXyPMM

Thanks!!

  • 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-19T03:02:07+00:00Added an answer on May 19, 2026 at 3:02 am

    I have used JQuery to get results from a database and populate a UL on a page with the items. Is this what you were looking for?

    Javascript

    
            //Set up Approve Requests Page
            $("#approveRequests").bind('pageAnimationEnd', function () { getRequestList(); return false; });
    
            //Gets the list of requests
            function getRequestList() {
                // call server-side webmethod using jQuery
                $.ajax({
                    type: "POST",
                    contentType: "application/json; charset=utf-8",
                    url: "Index.aspx/GetOrdersForApproving",
                    data: "{ }", // send an empty object for calls with no parameters
                    dataType: "json",
                    success: displayRequests,
                    failure: reportError
                });
            }
    
            //displays the requests in the ul
            function displayRequests(result) {
                // ASP.NET encapsulates JSON responses in a property "d"
                if (result.hasOwnProperty("d")) { result = result.d; }
                // iterate through player list and add info to the markup
                var ul = $("#requestsForApproval");
                for (i = 0; i 

    " + result[i].Supplier + "

    ," + result[i].Description + "," + result[i].Value + ""); var li = $("" + "

    " + result[i].OrderID + " - " + result[i].Supplier + "

    " + "" + "" + result[i].Description + "" + " " + "" + "" + "" + "Quant: " + result[i].Quantity + "" + "" + "Price: " + result[i].UnitPrice + "" + "" + "Total: " + result[i].Value + "" + "" + "" + "" + " " + "
      Approve" + "Reject
    " + "" + "" + ""); ul.append(li); }

    ASPX

    
            /// 
            /// Gets a list of Request Lines
            /// 
            /// List of order lines
            [WebMethod]
            public static List GetOrdersForApproving()
            {
                try
                {
                    List Lines = new List();
                    foreach (Objects.Database.OrderLine oOrderLine in Objects.Database.OrderLine.GetLinesWaitingFor(StaticStore.CurrentUser.UserID, int.MinValue))
                    {
                        Lines.Add(new iOrderLine(oOrderLine));
                    }
    
                    return Lines;
                }
                catch (Exception)
                {
                    throw;
                }
            }
    
    

    The bit that code me struggling to get this working was:

    if (result.hasOwnProperty("d")) { result = result.d; }
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a c# web service that I call using jquery ajax. It works
i have a simple asmx page with one web method which return array of
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
I have a web-service that I will be deploying to dev, staging and production.
Some existing web services I consume have methods that look something like this: List<Employee>
If I have a web service method, e.g. [WebMethod] [XmlInclude(typeof(SportsCar)), XmlInclude(typeof(FamilyCar))] public Car[] GetCars()
Say I have an ASMX web service, MyService. The service has a method, MyMethod.
I have created a web service which has a couple of methods developed using
I have a simple web site ( http://www.kousenit.com/twitterfollowervalue ) that computes a quantity based

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.