将服务器控制值作为jquery参数传递

时间:2013-03-20 19:14:45

标签: jquery asp.net ajax servercontrols

我正在尝试从下拉列表中获取值,并通过jquery将所选值作为参数传递给AJAX页面方法调用。如何在呼叫的data:参数段中引用控件的选定值?我只是用它的ID来引用它吗?这就是我所拥有的:

    $(document).ready(function()
{
    $("#AssignEmployeeButton").click(function()
    {
        $.ajax(
        {
            type: "POST",
            url: "TeamManager.aspx/IsOnlyTeamEmployee",
            data: "{'employeeId': *control value here*}",
            contentType: "application/json; charset=utf-8",
            success: function(msg)
            {
                //function body will go here
            }
        }
    }
}

1 个答案:

答案 0 :(得分:1)

$.ajax({
    data: "{'employeeId': $('#idOfYourDDL').val()}"
});