开发者

Get value from jQuery in asp.net code nugget?

How开发者_StackOverflow社区 can I get the value from a select field (dropdownlist) into a "code nugget" using jQuery? I have seen this done, but can't find an example of it now.

I have two dropdownlists, and I want to get the selected values from them and concatenate it into an id parameter to send to an action method:

$.get('<%= Url.Action("GetTasks","Timesheet", new { id = [Concatenated value here] } %>'

How can I get the concatenated selected values from the two dropdownlists with jQuery?


You could try something like this:

var url = "<% Url.Action("GetTasks", "Timesheet", new { id = "{0}" }) %>";

var selected = $("#mySelect").val().join(",");
url = url.replace("{0}", selected);

$.get(url);
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜