• jquery 读取textarea内容


    [root@yyjk templates]# cat displayCustomExport.html 
    
    1.
    <html>
    <head>
    	<title>运维平台</title>
    	<link rel="stylesheet" type="text/css" href="/static/Css/Monitor/displayCustomExport.css">
    	<link rel="stylesheet" type="text/css" href="/static/Css/Public/header.css">
    	<link rel="stylesheet" type="text/css" href="/static/Css/Public/menu.css">
    </head>
    <body>
    	<include file="Public:header"/>
    	<div class="content">
    		<include file="Public:menu"/>
    		<div class="con fl">
    			<div id="condition">
    				<label class="condition">数据库服务名</label><input type="text" name="dbservice" class="equipment_sz1">
    				<label class="condition">数据库IP</label><input type="text" name="dbip" class="equipment_sz2">
    				<label class="condition">数据库用户名</label><input type="text" name="dbuser" class="equipment_sz3">
    				<label class="condition">数据库密码</label><input type="text" name="dbpass" class="equipment_sz4">
                                     <br />
                                     <br />
    				<label class="condition">自定义SQL</label><textarea  id="customsql" class="equipment_sz5"></textarea>
    				<label class="condition">保存的文件名</label><input type="text" name="exportname" class="equipment_sz6">
                                     <br />
                                     <br />
    				<input type="submit" value="导出" class="equipment_search_btn es_1">
    				<!--<input type="submit" value="组查找" class="equipment_search_btn es_2">-->
    			</div>
    			<table class="gridtable">
    				<tr>
    					<th>"导出成功后,请通过下面的url下载文件"</th>
    					<th>"select 'aa' from dual
    union all
    select 'bb' from dual
    union all
    select 'cc' from dual"</th>
    				</tr>
    			</table>
    		</div>
    	</div>
    </body>
    <script type="text/javascript" src="/static/Js/jquery-2.2.2.min.js"></script>
    <script type="text/javascript" src="/static/Js/Monitor/displayCustomExport.js"></script>
    <script type="text/javascript" src="/static/Js/Public/ajax.js"></script>
    </html>
    
    
    2.
    
    [root@yyjk Monitor]# cat displayCustomExport.js 
    $(function(){
            var _dbservice= $("input[name='dbservice']");
            var _dbip= $("input[name='dbip']");
    	var _dbuser= $("input[name='dbuser']");
    	var _dbpass= $("input[name='dbpass']");
    	var _customsql= $("#customsql");
    	var _exportname= $("input[name='exportname']");
            var _ip_bt = $(".content .con #condition .es_1");
               console.log(_customsql);
            _ip_bt.on('click',function(){
                    var data={};
                    data.dbservice=_dbservice.val();
                    data.dbip=_dbip.val();
                    data.dbuser=_dbuser.val();
                    data.dbpass=_dbpass.val();
                    data.customsql=_customsql.val();
                    data.exportname=_exportname.val();
                    var successfn = function(jdata){
                    $(".gridtable").empty();
                    var _HTML="<tr><th>DownLoad Url </th></tr>";
                     _HTML=_HTML+"<tr><td>"+jdata+"</td></tr>";
                    $(".gridtable").html(_HTML); 
                    };
                    var errorfn = function(){
                    alert("数据获取出错");
                    };
                    $.ajax({
    				type: "get",
    				data: data,
    				url: "/api/exportcustomdata",
    				dataType: "text",
    				success: function(d){
    					successfn(d);
    				},
    				error: function(e){
    					errorfn(e);
    				}
    			});
            });
    	}
    )
    
    
    
    3.
    def exportcustomdata(req):
       print req.get_full_path();
       print req.GET['dbservice']
       dbservice= req.GET['dbservice']
       print req.GET['dbip']
       dbip= req.GET['dbip']
       print req.GET['dbuser']
       dbuser= req.GET['dbuser']
       print req.GET['dbpass']
       dbpass= req.GET['dbpass']
       print req.GET['customsql']
       customsql= req.GET['customsql']
       filename= req.GET['exportname']
       print '-------------------------'
       print filename
       print '-------------------------'
       output=commands.getoutput("perl /root/sbin/unload_custom.pl %s %s %s %s %s %s "  %(dbservice,dbip,dbuser,dbpass,customsql,filename) )
       print output

  • 相关阅读:
    [转载][开源框架推荐]VTDXML:世界上最快的XML处理框架
    iptables规则的查看、添加、删除和修改
    [转载]Linux大文件传输
    nginx+ php 安装配置实用
    wojilu框架代码分析之ActionProcessor.Process()
    数据库范式通俗理解,谈谈数据库设计
    我记录综合系统学习研究之用户管理二(wojilu.Web.Controller.Users MainController)
    我记录学习研究之前端开发二(js基于1.8版)
    我记录综合系统学习研究之开篇
    我记录综合系统学习研究之用户管理一(wojilu.Web.Controller.Users MainController)
  • 原文地址:https://www.cnblogs.com/hzcya1995/p/13349325.html
Copyright © 2020-2023  润新知