Language: C#
No Title
function setWards(o) {
$.getJSON('/Home/GetWards/?cbd_id=' + o.value, null, function(data) {
$('#ward').empty();
$.each(data, function(i, item) {
$('<option/>').attr('value', item.ID).html(item.Name).appendTo('#ward');
});
});
}
public JsonResult GetWards(int cbd_id)
{
return (this.Json((from w in db.Wards
where w.CBUID == cbd_id
select new
{
ID = w.ID,
Name = w.Name
}
).ToList()));
}
<%= Html.DropDownList("ward", Model.Wards, new { @class = "sectionDD" }) %>
Tags:
Description:
update a select from a ajax jsonresult
Report Abuse
Subscribe
Discuss
What's new
What is it
New Snippet
Recent Snippets
My Snippets
Web Code
Search

