您好,登录后才能下订单哦!
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
<script src="js/jquery-1.7.2.js"></script>
</head>
<body>
<form action="">
<select name="college" id="college" ></select>
</form>
<script>
$(function(){
$.get("jsonserver.jsp",function(data){
for(var i=0;i<data.length;i++)
$("#college").append(new Option(data[i].cname,data[i].value));
},"json");
})
</script>
</body>
</html>
jsonserver.jsp页面
<%@ page language="java" contentType="text/html; charset=Utf-8"
pageEncoding="Utf-8"%>
<%
response.setHeader("Content-Type","text/xml");
response.setHeader("charset","utf-8");
String result ="[{\"value\":0,\"cname\":\"软件学院\"},{\"value\":\"1\",\"cname\":\"计算机学院\"}]";
System.out.println(result);
out.print(result);
out.flush();
%>
免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。