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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T10:34:03+00:00 2026-06-15T10:34:03+00:00

I have some JSON objects that I want to process on Client Side, but

  • 0

I have some JSON objects that I want to process on Client Side, but My WebMethod that I specified does not want to fire.

Here is the Ajax and GetJson methods i used in my Client Side Script:
GetSJON

$(document).ready(function() {
         $(document).ready(function() {
             //attach a jQuery live event to the button
             $('#getdata').live('click', function() {
             $.getJSON('/Members_Only/StockMovement/WebForm1.aspx/StockPlacementOptions', function(data) {
               //alert(data); //uncomment this for debug
              // alert(data.item1 + " " + data.item2 + " " + data.item3); //further debug
             $('#showdata').html("<p>item1=" + data.item1 + " item2=" + data.item2 + " item3=" + data.item3 + "</p>");
        });
    });
});

Here is the Ajax

$(document).ready(function () {
        $.ajax({
            type: "POST",
            url: "/Members_Only/StockMovement/WebForm1.aspx/StockPlacementOptions",
            contentType: "application/json; charset=utf-8",
            dataType: "json",
            data: "{}",
            success: function (res) {
                $('#Results').append(CreateTableView(res)).fadeIn();
            }
        });
    });

Both of these Methods Call StockPlacementOptions which is my WebMethod that look like this:

 [WebMethod]
    [ScriptMethod(ResponseFormat = ResponseFormat.Json,
    UseHttpGet = true, XmlSerializeString = false)]
    public static List<StockReturnMethod> StockPlacementOptions()
    {
        scmEntitiesPrimaryCon entities = new scmEntitiesPrimaryCon();
        var binOptions = (from avail in entities.ProductAvailibleBins(1, 2)
                          select new StockReturnMethod() { LotID = (int)avail.LotID, LotName = avail.LotName, AreaID = (int)avail.AreaID, AreaName = avail.AreaName, BinID = (int)avail.BinID, BinName = avail.BinName }).ToList();

        return binOptions;
    }

If I can just get the JSON web Method to fire on $(document).ready event, I will be able to process and work with the data from there. I have also tried looking at a diffrent jQuery library like KnockoutJS with it’s data processing capability, also no luck.
I am using ASP Webforms on Framework 4 with Html5 Markup.

Any advice will be greatly appreciated.

  • 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-06-15T10:34:04+00:00Added an answer on June 15, 2026 at 10:34 am

    I got it fixed by using a combination of KnockoutJS and ajax.

    By utilizing the knockoutJS mapping model, I am able to manipulate the returned JSON anyway i want 🙂

    Here is my Jquery that does the Mapping and obtains JSON from server.

    <script type="text/javascript">
    //Declareing Viewmodel For KnockoutJS
        var viewModel;
        //Using Mapping Plugin for Knockout JS
        function bindModel(data) {
            viewModel = ko.mapping.fromJS(data);
            console.log(viewModel);
            ko.applyBindings(viewModel);
        }
    
        //Onload ObtainJSON
        $(document).ready(function () {
            $.ajax({
                url: "WebForm1.aspx/StockPlacementOptions",
                // Current Page, Method
                data: {},
                // parameter map as JSON
                type: "POST",
                // data has to be POSTed
                contentType: "application/json",
                // posting JSON content
                dataType: "JSON",
                // type of data is JSON (must be upper case!)
                timeout: 10000,
                // AJAX timeout
                success: function (result) {
                    bindModel(result);
                },
                error: function (xhr, status) {
                    alert(status + " - " + xhr.responseText);
                }
            });
        });
    
    </script>
    

    I also changed the Webmethod slightly to obtain the result i wanted:

    [WebMethod]
        [ScriptMethod(ResponseFormat = ResponseFormat.Json)]
        public static List<StockReturnMethod> StockPlacementOptions()
        {
            scmEntitiesPrimaryCon entities = new scmEntitiesPrimaryCon();
    
            var binOptions = (from avail in entities.ProductAvailibleBins(1, 2)
                              select new StockReturnMethod() { LotID = (int)avail.LotID, LotName = avail.LotName, AreaID = (int)avail.AreaID, AreaName = avail.AreaName, BinID = (int)avail.BinID, BinName = avail.BinName }).ToList();
    
            return binOptions;
        }
    

    And That’s it 😀

    Thanks for all the help

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

Sidebar

Related Questions

Some code that I don't have control over is overriding the global JSON object
I have looked at GSON to parse some of my JSON objects. However, this
I am trying to output some Java objects as JSON, they have List properties
Inside my .aspx I have some JSON code that looks like this: function someFunctionName()
I have some simple .NET objects I'd like to serialize to JSON and back
I have a series of Moose objects that I'm looking to feed to JSON::XS
I have some base initial data that I want to include in a Django
I have some JSON data that I get from a server. In my JavaScript,
I have two ajax functions that fetch JSON objects using .getJSON and then build
I have a Sinatra server that is returning multiple JSON objects from the database

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.