日期:2014-05-16 浏览次数:20852 次
$(document).ready(function() { $.ajax({ type: "POST", contentType: "application/json", url: "copyUserRole.aspx/GetJsonUserRole", data: "{}", dataType: "json", success: function(result) { try { eval("var userRole=" + result.d); $.each(userRole, function(i) { $("#tdUserGroup").append("<input type='radio' name='userGroup' value='" + userRole[i].roleId + "'/>" + userRole[i].roleName); if ((i + 1) % 5 == 0) { $("#tdUserGroup").append("<br/>"); } }); } catch (e) { alert(e); return; } }, error: function(result, status) { if (status == "error") { alert(status); } } }); $.ajax({ type: "POST", contentType: "application/json", url: "setUserGroup.aspx/GetUserRoleByUserId", data: "{userId:'" + '<%=Request["userId"] %>' + "'}", dataType: "json", success: function(result) { try { if (result.d != null) { document.getElementById("txtaReason").disabled = false; //问题:result.d每次都出来,就是下面这句有时不起作用 $("input[@type=radio][@value=" + result.d + "]").attr("checked", true); } } catch (e) { alert(e); return; } }, error: function(result, status) { if (status == "error") { alert(status); } } }); });