我有下面的html页面,当您在下拉列表中选择一个项目时,它会运行一个函数。 每次我单步执行该功能,我都会到达
行 $("#ddlRoute").html(procemessage).show();
我收到此错误:uncaught typeerror:$不是函数
你知道这是什么吗?我该如何解决这个问题?
@using (Html.BeginForm())
{
<div id="RowOne-form">
<div class="section1">
<h2>Select a Customer</h2>
<div>
<label for="Branch">Branch:</label>
@Html.DropDownListFor(m => m.SelectedBranch, Model.BranchList, "Select Branch", new { @id = "ddlBranch", @style = "width:200px;", @onchange = "javascript:GetRoute(this.value);" })
</div>
<div>
<label>Route:</label>
<select id="ddlRoute" name="ddlRoute" style="width: 200px"></select>
</div>
</div>
<hr />
<div class="form-Buttons-Sec" style="margin:35px;">
<input id="Save1" type="button" value="Save"/>
<input id="Cancel1" type="button" value="Cancel" />
</div>
}
<script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/jquery-ui.min.js"></script>
<script language="javascript" type="text/javascript">
function GetRoute(_branchId) {
var procemessage = "<option value='0'> Please wait...</option>";
$("#ddlRoute").html(procemessage).show();
var url = "/Home/GetRouteByBranchId/";
$.ajax({
url: url,
data: { branchId: _branchId },
cache: false,
type: "POST",
success: function (data) {
var markup = "<option value='0'>Select City</option>";
for (var x = 0; x < data.length; x++) {
markup += "<option value=" + data[x].Value + ">" + data[x].Text + "</option>";
}
$("#ddlRoute").html(markup).show();
},
error: function (reponse) {
alert("error : " + reponse);
}
});
}
</script>
答案 0 :(得分:0)
看来你用来获取jQuery引用的url可能不正确。尝试使用这个......
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.8.0/jquery.min.js"></script>