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

The Archive Base Latest Questions

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

This is a very basic question, I think I ask very tough questions on

  • 0

This is a very basic question, I think I ask very tough questions on here and they never get answered… Let me break it down to its simplest possible components and work up from there…
I have a view which requires user information to be entered in… on submit, this view calls a controller, which will give me the data that I need to put back on to this SAME view… How do I get get that data back onto my view without calling the same view again at the end of the execution of the controller…?

Here is what I have so far (Jquery function)…

     $(function () {
    $("#DemoGraphSubmit").click(function (e) {
        e.preventDefault();
        var data = [];
        $.getJSON("/PatientACO.aspx/SearchByDemographic", null, function (data) {
            data = $.map(data, function (item, a) {
                return "<option value=" + item.Value + ">" + item.Text + "</option>";
            });
            $("#PatientListToAdd").html(data.join(""));
        });
    });
});

submit button and select list that I want populated

    <div >
    <select id="PatientListToAdd">Add Patient</select>
    </div>
  • 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:31:34+00:00Added an answer on May 24, 2026 at 3:31 am

    While my example doesn’t exactly mimic your design (you might be using a page method or some questionable routing), but as long as /PatientACO.aspx/SearchByDemographic is returning JSON, you should be able to apply this code. Populate the List<ListItem> collection with your data as needed and return JSON.

    I added an action called SearchByDemographic, and you will see in my jQuery further down that I use it instead of your URL. However, it still accepts POST requests and returns JSON.

    [HttpPost]
    public JsonResult SearchByDemographic()
    {
        List<ListItem> list = new List<ListItem>() {
            new ListItem() { Value = "1", Text = "Patient 1" },
            new ListItem() { Value = "2", Text = "Patient 2" },
            new ListItem() { Value = "3", Text = "Patient 3" }
        };
    
        return this.Json(list);
    }
    

    Then, my jQuery is slightly modified to use $.ajax which is just longhand for $.getJSON and it allows a few more options.

    $('#DemoGraphSubmit').click(function (e) {
        e.preventDefault();
    
        $.ajax({
            url: 'SearchByDemographic',
            type: 'POST',
            success: function (data) {
                $.each(data, function (i, optionData) {
                    var option = new Option(optionData.Text, optionData.Value);
                    $('#PatientListToAdd').append(
                        $('<option></option>').val(optionData.Value).html(optionData.Text)
                    );
                });
            }
        });
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This is very basic magento question i guess. I want to first get all
This is a very basic question...quite embarassing, but here goes: I have a Stopwatch
I think this is almost certainly a very basic question but I'm struggling with
This is very basic question from programming point of view but as I am
This is a very basic question. I'm just on my mission to learn ASP.NET
This is a very basic question, so please bear with me. Consider the following
This is a very very basic question and I know one way is to
I know this maybe a very basic question but I'm having a bit of
Apologies if this is a very basic question, but I am preparing to create
I realise that this is a very basic question, but it is one which

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.