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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T13:15:44+00:00 2026-06-08T13:15:44+00:00

I can successfully make a jQuery Ajax call into my C# Controller and receive

  • 0

I can successfully make a jQuery Ajax call into my C# Controller and receive back an XML string, but I need to in turn gather some Portfolio dates and package them up into a JSON object so I can send them back into another C# Controller.
If it’s a C# issue, then I apologize if I’m in the wrong forum…however I’d like to pass my JSON object into the server side controller ..

Here’s what I’m trying to do:

        var nodeDatesJson = {"nodedates":        // CREATE JSON OBJECT OF DATE STRINGS
                            { "date": 01/20/2012,
                              "date": "01/21/2012" } };
        getTradeContribs(thisPfId, nodeDatesJson.nodedates.date);     

Now call the next js function:

 function getTradeContribs(pfid, nodedates) {
        //alert(nodedates);
        $.ajax({                                // GET TRADE CONTRIBS FROM SERVER !!
            url: "/Portfolios/getTradeContribs?portfolioId=" + pfid + "&nodedates=" + nodedates,
            type: "GET",    // or "PUT"
            dataType: "json",               
            async: true,
            success: parseTradeContribs,
            error: function (error) {
                alert("failed in opening Trade Contribs file !!!");
            }
        });
    }
    function parseTradeContribs(data) {
        alert("In parseTradeContribs..." );
        $(data).find("Trade").each(function(){
            $(".TradeContrib").append($(this).text());
        })
    }

and my C# controller is trying to read in the “nodedates” JSON object, but HOW do I read it in ?

   public string getTradeContribs(string portfolioId, **string nodedates**)
        {

            // Build Portfolio Select request here !
            RequestBuilder rzrRequest = new RequestBuilder();

            // REQUEST FOR CONTRIBUTIONS !
            // ... more code here..
            xmlResponse.LoadXml(contribResponse);

            string jsonTest = @" {""nodedates"": ""date"":""01/01/2012""}";

            //return xmlResponse.OuterXml;  // WORKS FINE
            return "<Trade><TradeId>1234</TradeId></Trade>";    // RETURN TEST XML STR

        }

thank you in advance…
Bob

  • 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-08T13:15:46+00:00Added an answer on June 8, 2026 at 1:15 pm

    The best way to receive a list of dates in a MVC action is to bind to a collection. What this means is that you should put your dates and other attributes in a form with the following naming convention:

    <input type="hidden" name="dates" value="2012-1-20" />  
    <input type="hidden" name="dates" value="2012-1-21" />  
    

    Then you should serialize this form (look into jquery’s docs for this) and post its data to your action, which will be something along the lines of:

    public ActionResult getTradeContribs(string portfolioId, IList<DateTime> dates) {
      // Do your work here
    }  
    

    You should really take a look into MVC Model binding and collection binding as well:
    Model binding to a list
    Model binding objects


    Also, if I may, your javascript object has two properties with the same name, which is probably not what you mean. If you want to have multiple dates stored somewhere in a object, you should use an array:

        var nodeDatesJson = {"nodedates":  
                            [ "01/20/2012", "01/21/2012" ] };  
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

can someone show me how to make a jquery ajax completion event. $(#submit_js).click(function() {
How can I make my jQuery multi-stage form fade out on successful submission and
I can successfully receive email from SendGrid and process its data. My problem is
the title already tells the question: you can successfully call the Print-Method on a
I have a form which is validated through jquery, but I need the blur
I have a BroadcastReceiver that can successfully catch a broadcast, but if I try
I'm trying to make a post request via ajax using jQuery (for the BaseCamp
I've read about the jQuery.ajax method and believe this should be what I need
Help me please i'm a newbie in ajax and framework jQuery , i make
I have a website where I make an ajax call like this: // perform

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.