加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

ajax报告申请添加

发布时间:2020-12-16 03:04:46 所属栏目:百科 来源:网络整理
导读:function reportApplyAddFun(){ $( " #dlg " ).dialog( " open " ).dialog( " center " ).dialog( " setTitle " , ‘‘ ); // ‘‘(二级页面标题) $( " #fm " ).form( " clear " ); $.ajax({ // 加载报告申请基础数据 type : " post " ,url : " reportApplyB
                  function reportApplyAddFun(){
                      $("#dlg").dialog("open").dialog("center").dialog("setTitle",‘‘);// ‘‘(二级页面标题)
                    $("#fm").form("clear");
                    $.ajax({// 加载报告申请基础数据
                        type : "post",url : "reportApplyBase",data:{"flag":"1"},cache : false,async : false,dataType : "json",success : function(data){
                            var str = "<select class=‘‘ style=‘width: 210px;‘ autocomplete=‘off‘>"
                            var itemStr = "";
                            $.each(data,function(index,value){
                                var itemName = data[index].name;
                                alert(itemName);
                                itemStr += "<option value=‘0‘ selected=‘selected‘>" + itemName + "</option>"
                                str += itemStr;
                            })
                            str + "</select>";
                            document.getElementById("companyNature").innerHTML = str;
                        },error:function(data){
                                alert("加载数据失败!" + data);
                        }
                    });
                  }
/**
     * 获取字典数据
     * @param request
     * @param response
     * @param map
     * @return
     */
    /*@RequestMapping("reportApplyBase")
    public String saveInfo(HttpServletRequest request,HttpServletResponse response) {
        String flag = request.getParameter("flag");
        log.info(flag);
        List<ReportApplyBase> reportApplyBaseList = new ArrayList<ReportApplyBase>();
        String json = null;
        try {
            Class.forName("com.mysql.jdbc.Driver");
            con = DriverManager.getConnection(DB_URL,USER,PASS);
            stmt = con.createStatement();
            rs = stmt.executeQuery("select * from test");
            while (rs.next()) {
                ReportApplyBase reportApply = new ReportApplyBase();
//                reportApply.setId(rs.getInt(Integer.parseInt("id")));
                reportApply.setName(rs.getString("name"));
                reportApply.setAddress(rs.getString("address"));
                reportApplyBaseList.add(reportApply);
            }
            // list转为json传入前端
            json = JSON.toJSONString(reportApplyBaseList);
            log.info(json);
            // 取得流向JSP传递数据
            response.setContentType("text/html;charset=UTF-8");
            response.getWriter().println(json);
            response.reset();
        } catch (Exception e) {
            log.info(e.getMessage());
            e.printStackTrace();
        } finally {
            try {
                con.close();
                stmt.close();
            } catch (SQLException e) {
                e.printStackTrace();
            }
        }
        return json;
    }*/

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读