I have a drop down list
<%=Html.DropDownList("genre", Model.genres, "", new { @onchange = ChangeMovie()" })%>
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) {}
});
};
Controller code
public ActionResult GetGenre(string genreName)
{
}
I want to pass the selected value of the drop-down list to the result of the action in the controller code through the js function. I need help managing JavaScript code and AJAX call code, so the correct value is passed to the controller.
source
share