1.
function setNumber($this,g,d,url){ var gid = $this.parent().attr("data-id"); var eids = $("#hidden").text(); var params = {}; params[g] = gid; //传参 params[d] = eidsl;//传参
if(eids==""){ layer.alert("勾选项为空,请选择"); return false; }else{ $.ajax({ method: 'put', url: url, data: params, success:function(data){ if(data){ $("#modal").modal("hide"); }else{ layer.msg("操作失败") } } }) } }
2.
$("body").on("click","#setstudent",function(){ var $this = $(this); var g = "expertGroupIds"; var d = "examineeGroupIds"; var url = "/expert/related_groups"; setNumber($this,g,d,url) });