首先,要添加命名控件如下:
using System.Web.Services;
server端的方法
[WebMethod()]
public static ArrayList GetAuthByModuleID(string ModuleID)
{
ArrayList moduleList=new ArrayList();
moduleList.Add(new ListItem("SCAR.NEW_SCAR", "1"));
return moduleList;
}
client端的处理
$.ajax({
type: "POST",
url: "Authority.aspx/GetAuthByModuleID",
contentType: "application/json; charset=utf-8",
data: ‘{"ModuleID":"‘ + $(‘#hidModuleID‘).val() + ‘"}‘,
dataType: "json",
success: function (msg) {
$(‘#divAuth‘).html("");
$.each(msg.d, function () {
$(‘#divAuth‘).append($(‘<input id="cbAuth_‘+this["Value"]+‘" type="checkbox" /><label>‘+this["Text"]+‘</label>‘));
});
}
});
时间: 2024-10-02 08:49:34