【发布时间】:2017-03-15 12:05:02
【问题描述】:
<div class="input-group" style="margin-bottom:30px;">
<span class="input-group-addon">
Brand
</span>
@Html.DropDownListFor(x => x.BrandMod.Id, c,"- Select Brand - ", new { @class = "form-control" ,id="brandid" })
</div>
“这是我的下拉代码,我想选择所选项目。我正在尝试这个”
$("#brandid").change(function (rupp) {
var a = $(this).select("option:selected").val();
});
“我无法加载所选项目。”
【问题讨论】:
-
不就是
$(this).val()吗? -
是的,这是有效的。感谢您的支持。
-
$("#brandid").change(function (rupp) { var a = $(this).val();//select("option:selected").val(); alert(a); $.ajax( { url: "~/Product/GetCategory" + a, type="get" } ).done(function(rab) { alert(rab); }); });跨度>
-
现在我无法在相同的代码中进行 AJAX 调用。
-
好吧,这个问题中的代码不会尝试进行任何 AJAX 调用。所以这似乎是问题所在。如果您对不同的代码有不同的问题,最好为此创建一个新问题。
标签: c# jquery asp.net-mvc razor