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

  • Home
  • SEARCH
  • 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 9103627
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T01:40:39+00:00 2026-06-17T01:40:39+00:00

I have a view called Forms that I am displaying and it has a

  • 0

I have a view called Forms that I am displaying and it has a dropdownlist. When the dropdownlist has a different selection, I have a jquery that gets called as so:

    $(document).ready(function () {
        $("#myDropDownList").change(function () {
            $.ajax({
                url: '/Home/Forms/' + $("#myDropDownList option:selected").val(),
                type: 'GET',
                success: function (data) {
                // refresh div
                }
            });
        });
    });

Here is My Forms View:

    @model myProject.ViewModels.PageView

    @section JavaScript
    {
       <script type="text/javascript" src="@Url.Content("/Scripts/jquery.myJQuery.js")"></script>
    }

    @Html.DropDownList("myDropDownList", Model.selectList)

    <div id="somediv">
       @Html.Label(Model.ValueThatShouldChange)
    </div>

So when the Forms action gets called again, I have ValueThatShouldChange in my ViewModel that will change and they will be displayed in the div. This is why I want to refresh that div but I am not sure how to do that.

I tried $('#yourdivID').html(data) but it load my entire view in the 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-06-17T01:40:40+00:00Added an answer on June 17, 2026 at 1:40 am

    The easiest way is to use the load() function to load just the specific part of the page you need by selecting it using its id. E.g.:

    $("#yourDivId").load("/Home/Forms/ #" + $('#myDropDownList option:selected').val())
    

    Depending on the way your webpage is build (you don’t provide that info), you can also change your Ajax call by including a parameter to load the content you need. E.g.:

    $(document).ready(function () {
        $("#myDropDownList").change(function () {
            $.ajax({
                url: '/Home/Forms/' + $("#myDropDownList option:selected").val(),
                data: { id : $('#myDropDownList option:selected').val() }
                type: 'GET',
                success: function (data) {
                   $('div#yourDivId').html(data);
                }
            });
        });
    });
    

    And in your page you just output the content you need based on the id (if it’s PHP):

    <? if (isset($_POST['id'])) {
          if ($_POST['id'] == "somediv") { ?>
             <div id="somediv">Just this content should be loaded</div>
       <? }
       }
       else { ?>
         <!-- your regular html... -->
    ?  }   ?>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a view called Associations that has a drop down list and a
I have a view that could be called from any of 3 actions from
I have a resource called patient_admissions that has all the RESTful routes. It is
i have a treeview on a web forms application. i have javascript function that
I have an action called Messages which has two forms. The first form posts
I have a view called contact.html.twig. It has a form with some textfields. I
I have a view called, clients which shows a list of calls from the
General context : MVVM application. I have a View called JobView. Its DataContext is
I have a Django view called change_priority. I'm posting a request to this view
Ok, so here's the situation. I currently have a view controller called MainViewController 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.