1 Star 0 Fork 1

mcaomao/asp-json-select

forked from sixgod/asp-json-select 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
select.asp 3.62 KB
一键复制 编辑 原始数据 按行查看 历史
sixgod 提交于 2019-12-09 16:16 . 2019.12.9
<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<!--#include file="json.asp"-->
<%
'打开数据库连接
dim conn,connstr,db,rs
db="databases.mdb"
Set conn = Server.CreateObject("ADODB.Connection")
connstr="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath(""&db&"")
conn.Open connstr
%>
<html class="x-admin-sm">
<head>
<meta charset="GB2312">
<title>后台系统</title>
<meta name="renderer" content="webkit">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width,user-scalable=yes, minimum-scale=0.4, initial-scale=0.8,target-densitydpi=low-dpi" />
<link rel="stylesheet" href="./css/font.css">
<link rel="stylesheet" href="./css/xadmin.css">
<script src="https://code.jquery.com/jquery-3.1.1.min.js"></script>
<script type="text/javascript" src="./lib/layui/layui.js" charset="utf-8"></script>
<script type="text/javascript" src="./js/xadmin.js"></script>
</head>
<body>
<div class="layui-fluid">
<div class="layui-row">
<form class="layui-form">
<div class="layui-form-item">
<label for="college" class="layui-form-label">
<span class="x-red">*</span>院系</label>
<div class="layui-input-inline">
<select id="college" name="college" class="valid" lay-filter="college">
<% set rs=server.CreateObject("adodb.recordset")
rs.open "select * from college",conn,1,1
do while not rs.eof%>
<option value="<%=rs("id")%>"><%=rs("college")%></option>
<% rs.movenext
loop%>
</select>
</div>
</div>
<div class="layui-form-item">
<label for="major" class="layui-form-label">
<span class="x-red">*</span>专业</label>
<div class="layui-input-inline">
<select id="major" name="major" class="valid">
</select>
</div>
</div>
</form>
</div>
</div>
<script>layui.use(['form', 'jquery','layer'],
function() {
$ = layui.jquery;
var form = layui.form,
layer = layui.layer;
/**第一种写法*/
form.on('select(college)',function(data){
var val=data.value;
console.log(val)
$.ajax({
url: "test.asp",//请求地址
type: "Get",//请求方式
dataType: "JSON",//返回数据类型
data: {val: val},//发送的参数
success:function(data){
console.log(data.data);
var resdata=data.data
var proHtml = '';
for(var o in resdata){
proHtml += '<option value="' + resdata[o].id + '">' + resdata[o].major + '</option>';
}
$('#major').html(proHtml);
form.render();
},
})
})
});
</script>
</body>
</html>
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/mcaomao/asp-json-select.git
[email protected]:mcaomao/asp-json-select.git
mcaomao
asp-json-select
asp-json-select
master

搜索帮助