html
<script type="text/javascript">
$(document).ready(function () {
$("#musteri_sno").change(function () {
var strSayacID = "";
strSayacID = $(this)[0].value; // get the selected state id
var url = "/SayacOkumalari/MusteriSayaclariniGetir/" + strSayacID;
// call controller's action
$.getJSON(url, null, function (data) {
// do something once the data is retrieved
$("#sayac_no").empty();
$.each(data, function (index, optionData) {
$("#sayac_no").append("<option value='"
+ optionData.sno
+ "'>" + optionData.sayac_seri_no
+ "</option>");
});
});
})
.change(); // making sure the event runs on initialization for default value
});
</script>
@using (Ajax.BeginForm("SayacSecimiPartial", "SayacOkumalari", new AjaxOptions { UpdateTargetId = "div_grafik" }, new { id="sayac_secimi_form"}))
{
<table>
<tr>
<td>
@Html.DropDownList("musteri_sno", (SelectList)ViewBag.musteri_id, "--Müşteri Seçiniz--", new { id = "musteri_sno" })
</td>
<td>
@Html.DropDownList("sayac_no", Enumerable.Empty<SelectListItem>(), "-- Sayaç Seçiniz --", new { id = "sayac_no" })
</td>
<td>
<input type="submit" value="Uygula" />
</td>
</tr>
</table>
}
此脚本适用于 localhost,但不适用于服务器。我的项目中有很多脚本,而且它们都在工作。只有这个脚本不起作用。我找不到,为什么?
谢谢。