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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T07:02:41+00:00 2026-06-04T07:02:41+00:00

I have a drop down <%=Html.DropDownList(genre, Model.genres, , new { @onchange = ChangeMovie() })%>

  • 0

I have a drop down

 <%=Html.DropDownList("genre", Model.genres, "", new { @onchange = ChangeMovie()" })%>

The JavaScript looks like (incomplete)

function ChangeMovie() {
    var genreSelection = container.find( '#genre' ).val();

    $.ajax({  
        "url" : "/Movies/GetGenre" ,
        "type" : "get" ,
        "dataType" : "json" ,
        "data" : { "selectedValue" : $( "#genre").val() },
        "success" : function (data) {}
    });
};

Conrtroller code

public ActionResult GetGenre(string genreName)
{
   //Need to get the `genreName` from the JavaScript function above.. which is
   // in turn coming from the selected value of the drop down in the beginning.

}

I want to pass the selected value of the drop down to the action result in the controller code via the js function. I need help manipulating the JavaScript code and the AJAX call code so the correct value is passed onto the controller.

  • 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-04T07:02:42+00:00Added an answer on June 4, 2026 at 7:02 am

    You have a lot of unnecessary quotes as well not returning JSON in your action

    $.ajax({
        url: "/Movies/GetGenre/",
        dataType: "json",
        cache: false,
        type: 'GET',
        data: {genreName: $("#genre").val() },             
        success: function (result) {
            if(result.Success) {
                alert(result.Genre);
            }
        }
    });
    

    Plus your controller isn’t returning Json, modify your action to this

    public JsonResult GetGenre(string genreName) {
        // do what you need to with genreName here 
        return Json(new { Success = true, Genre = genreName }, JsonRequestBehavior.AllowGet);
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a drop down list like so: <%= Html.DropDownList(SoldTo, Model.SellDealerList, Select a Dealer)%>
If I have a drop down list as follows <div class=editor-label> <%= Html.DropDownListFor(model =>
I have a @htmlDropDownList as @Html.DropDownList(MyList, new SelectList(Model.List, Id, Movie)) in a mvc3 view.
When I have a DropDownList that relevant to Model of view like this: @Html.DropDownListFor(model
I have multiple dropdown list: @Html.DropDownListFor(x => x.HaveColoSpace.SelectedOptions, new SelectList(Model.HaveColoSpace.Options, Value, Text), new {
I have a drop down in html. When I change the value of the
I have this code which can display drop down in div tag of html.
I have a <select> drop down that I'm inserting into my HTML via jQuery.
I have a drop down in a MVC View, which is some thing like
I have a dropdownlist in my asp.net MVC2 view like this: <% using(Html.BeginForm(temp,Settings)){ %>

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.