With the most true of yourself,can you meet the most suitable one.
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%--
Created by IntelliJ IDEA.
User: Administrator
Date: 2017/9/3/003
Time: 19:31
To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%
String path = request.getContextPath();
String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + path;
%>
<html>
<head>
<title>Title</title>
<script src="/resources/jquery/jquery-1.8.3.js"></script>
<script>
$(function () {
$("#s1").change(function () {
var arg=$("#s1").val();
alert("sdf"+arg);
$.ajax({
type:"get",
url:"${pageContext.request.contextPath }/parameter/selParm.action",
data:{
id:arg
},
dataType:"json",
success:function (data) {
$.each(data.data, function(i, item) {
$("<option value='" + item.id + "'>" + item.name + "</option>").appendTo($("#s2"));
});
},
error:function () {
alert("网路异常");
}
});
});
$("#s2").change(function () {
/* loadDevice($("#s1").val());*/
$.ajax({
type:"get",
url:"${pageContext.request.contextPath }/parameter/selParm.action",
data: {
id: $("#s2").val()
},
dataType:"json",
success:function (data) {
if(data=="{[]}"){
$("#deviceId").empty();
$("<option value='0'>查询所有</option>").appendTo($("#s3"));
}else{
$("#s3").empty();
$("<option value='0'>查询所有</option>").appendTo($("#s3"));
$.each(data.data, function(i, item) {
$("<option value='" + item.id + "'>" + item.name + "</option>").appendTo($("#s3"));
});
}
}
});
});
});
</script>
</head>
<body>
<select id="s1">
<option>请选择</option>
<c:forEach items="${parameterList}" var="pl" >
<option value="${pl.id}">${pl.name}</option>
</c:forEach>
</select>
<select id="s2">
<option >请选择</option>
</select>
<select id="s3">
<option >请选择</option>
</select>
</body>
</html>