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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T03:18:52+00:00 2026-05-24T03:18:52+00:00

I am having a slight issue sending formCollection data to my controller action method

  • 0

I am having a slight issue sending formCollection data to my controller action method in MVC using jQuery .Post method. While I am sending the data via jQuery, it is not in the formCollection parameter of my action controller, well let me be more specific, it is in there, but not quite how I expected it to be in there… First off, the formCollection parameter now has 2 entries… the PopID passed in (21) plus the serialized data passed in (FirstName=Fifo&LastName=Caputo&DateOfBirth=&DateOfBirth=7%2F29%2F2011+12%3A00%3A00+AM&City=&State=&Country=&Postal+Code=&deathIndicator=&email=&gender=&language=&NextOfKin=&Phone=)
What am I doing wrong here? Controller Action.

    [HttpPost]
    public ActionResult SearchByDemographic(int PopID, FormCollection formCollection)
    {
    }

JavaScript-Jquery method to pass in values…

    $(function () {
    $("#DemoGraphSubmit").click(function (e) {
        e.preventDefault();
        var form = $("#DemoGraphID");
        var srlzdform = form.serialize();
        var PopID = <% =PopID %>
        var options = [];
        var serializedForm = form.serialize();
        $.post("/PatientACO/SearchByDemographic", {PopID:PopID,srlzdform:srlzdform}, function (data) {
            options = $.map(data, function (item, i) {
                return "<option value=" + item.Value + ">" + item.Text + "</option>";
            });
            $("#PatientListToAdd").html(options.join(""));
        });
    });
});

Any ideas? I am going to keep looking.

  • 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-24T03:18:52+00:00Added an answer on May 24, 2026 at 3:18 am

    Try this:

    $.post("/PatientACO/SearchByDemographic", srlzdform, function (data) {
    

    Although I am not sure why you want to use a FormCollection instead of a viewmodel.

    Perhaps you want to take a look at NerdDinner

    So here is your view (obviously more complex than this)

    @model TestModel
    
    <form action="@Url.Action("SearchByDemographic","PatientACO")" method="post">
        @Html.HiddenFor(model => model.PopID)
        @Html.TextBoxFor(model => model.Text)
    </form>
    

    Here is your action:

    [HttpPost]
    public ActionResult SearchByDemographic(TestModel model)
    {
    }
    

    And here is your model

    public class TestModel
    {
        public int PopID { get; set; }
        public string Text { get; set; }
        // more properties
    }
    

    This way if you store your PopID in the model you don’t have to do <%: PopID %> in your javascript.

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

Sidebar

Related Questions

I am using MVC 2, and having a slight issue with the ActionLink not
I'm having a slight issue with my jQuery code. I've basically got a timer
Ok, I'm having a slight bit of confusion writing my own jQuery UI widget
I'm trying to access Windows XP's Application Data - but I'm having a slight
I'm having a slight issue wrapping my head around on how to set up
having a slight issue where i am rendering a pdf (stored as a byte
I'm using SF1.4 and Propel and I'm having a slight problem with trying to
Using the checkbox styling system here (with a few slight modifications): http://blogs.digitss.com/javascript/jquery-javascript/jquery-fancy-custom-radio-and-checkbox/ I have
I am having a slight performance issue with inline function. Consider the following code:-
I am having a slight issues with CSS and jQuery Mobile, I am trying

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.