I have a list box built like so...
@Html.ListBoxFor(model => model.SelectedCalendarId, Model.PeriodList)
and have wired up a call to my controller via jQuery and hard coded value works...
var calId = 12;
$.getJSON("/Publishing/GetLockState1", { calendarId: calId }, function (data) {//omitted}
so now, how do I get the Id the use开发者_如何学运维r has selected to pass into the json call, i.e. how to populate calId ? I tried
calId = $("#SelectedCalendarId").val()
but no joy.
Try:
calId = $("#SelectedCalendarId :selected").val()
精彩评论