0

Html.ListBoxがあり、アイテムを選択したら、アイテムIDを渡して、選択したアイテムの情報を呼び出してロードできるようにします。このIDをスクリプトに渡す最良の方法は何ですか、それとも別の方法がありますか?

     @Html.ListBox("ListBoxName", new SelectList((IEnumerable<Epic>)ViewData["selectedestimate"], "Id", "Name"), new {@class = "ListBoxClass"})



        <script type="text/javascript">
        $(function () {
            $(".ListBoxClass").click(function (event) {
        event.preventDefault(); // Stop the browser from redirecting as it normally would
        $("#editid").load(this.href, function (response) {
            alert('hello'); //this just for testing
        });
    });
});

4

1 に答える 1

1

関数に渡す必要はないと思います。これを実行できるはずです。

$(this).find("option:selected").val();
于 2012-04-14T00:34:57.383 に答える