我在使用 $.getJSON 的方法时遇到问题。很简单,看起来像这样:Take ID из DropDownlList CategoryId
<div id="partial" class="editor-label">
@* @Html.Partial("");*@
</div>
$(document).ready(function () {
$('#CategoryId').change(function () {
$.getJSON('/Publication/AjaxAction/' + this.value, {},
function (html) {
$("#partial").html(html);
alert("go");
});
});
});
发送
public ActionResult AjaxAction(int Id)
{
if (Request.IsAjaxRequest())
{
if (Id== 1)
{
ViewBag.SourceTypeId = new SelectList(db.SourceTypes, "Id", "Title");
ViewBag.CityId = new SelectList(db.Cities, "Id", "Title");
return Partial("_CreateStatya");
}
}
return PartialView();
}
你能告诉我如何退回部分吗?
<div id="partial" class="editor-label">
@* @Html.Partial("");*@
</div>