ajax 返回radio 和select
来源:互联网 发布:java|| 编辑:程序博客网 时间:2024/06/06 05:36
action
public void getNoticeTypeAuthority(){List<Map<String,Object>> noticeTypeList = codeManager.findNodeListForMap(SystemConstants.SYS_CODE_ENAME_NOTICE_TYPE, null, null, null);String noticeAuthority = this.getSysParameter();List<Map<String,Object>> noticeAuthoritylist = noticeManager.findNoticeList(noticeTypeList,noticeAuthority);try {HttpServletResponse response = ServletActionContext.getResponse();response.getWriter().print(JSONArray.fromObject(noticeAuthoritylist).toString());} catch (IOException e) {e.printStackTrace();}}
jsp
function initRadio(){var noticeType = document.getElementById("noticeType").value;var radio="";var retValue = $.ajax({ async:false, type: "POST", url: "sys-notice!getNoticeTypeAuthority.action", success: function(msg){ //alert( "Data Saved: " + msg ); }}).responseText;//alert("retValue" + retValue);if(retValue == ""){alert("获取公告类型失败。");return;} // 解析json对象var dataObj = eval("("+retValue+")");$.each(dataObj,function(idx,item){if(noticeType == item.nodeCode){radio += "<input type='radio' name='notice.noticeType' value='"+item.nodeCode+"' checked>"+item.nodeName+" ";}else{radio += "<input type='radio' name='notice.noticeType' value='"+item.nodeCode+"'>"+item.nodeName+" ";}}); $("#radioObj").html(radio);}
-------------------------------------------------------------
-------------------------------------------------------------
action
public void getContactAppPermitSelect(){String contactAppPermit = SystemAdapter.getSysParamCommByCode(SpringContextHolder.getApplicationContext(), SystemConstants.SYS_PERMIT_CONFIG_CONTACT);List<Map<String,Object>> nodeList = SystemAdapter.getSysCodeNodeList(SpringContextHolder.getApplicationContext(), SystemConstants.SYS_CODE_ENAME_APP_TYPE, null, null, null);List<Map<String,String>> sysPermitlist = contactManager.findContactAppList(nodeList,contactAppPermit,true);try {HttpServletResponse response = ServletActionContext.getResponse();response.getWriter().print(JSONArray.fromObject(sysPermitlist).toString());} catch (IOException e) {e.printStackTrace();}}
jsp
function initSelect(url,property,value){var select = "";select = "<select name='"+property+"' style='width:147px;'>"; select += "<option value=''>-请选择-</option>";var retValue = $.ajax({ async:false, type: "POST", url: url, success: function(msg){ //alert( "" + msg ); }}).responseText;// 解析json对象var dataObj = eval("("+retValue+")");if(dataObj==""){select += "<lect>";$("#selectObj").html(select);return;}$.each(dataObj,function(idx,item){if(value==item.code){select += "<option value='" +item.code+ "' selected='selected'>"+item.name+"</option>";}else{select += "<option value='" +item.code+ "'>"+item.name+"</option>";}}); select += "</select>";$("#selectObj").html(select);}
- ajax 返回radio 和select
- radio和select
- jquery获取radio和select
- select和radio常用操作
- jquery和js操作checkbox radio select
- select,radio 和checkbox动态自动匹配。
- JS操作Button、Select和Radio
- Angular <select> 和<radio> ngModel 绑定
- struts2 <s:radio> 和 <s:select>标签
- s:radio 返回值和s:checkboxlist 返回值问题
- jquery radio,checkbox,select,radio
- 怎么得到Radio、Checkbox和Select选择的值
- struts 取select控件和radio控件的值
- jquery获取和设置radio,check,select选项
- jQuery获取,遍历和操作表单元素Select,checkbox,radio
- jquery获取和设置radio,check,select选项
- jquery获取和设置radio,check,select选项
- jquery获取和设置radio,check,select选项
- 创建型模式_工厂方法
- SQL数据的分组与聚合
- 编写函数实现求余运算
- Facebook开放平台分析
- 利用animation轻松写出动态加载框
- ajax 返回radio 和select
- arm gcc内嵌汇编
- android viewlist
- Google Analytics——10条有用教程
- 关于各种无法解析的外部符号问题的相应解决方案
- 闲扯几句写作与阅读
- MySQL中两种索引Hash与B-Tree的区别
- C语言中常用三种排序方法
- android IPC---Binder