<%@ page language="java" import="java.util.*" pageEncoding="gbk"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme() + "://"
+ request.getServerName() + ":" + request.getServerPort()
+ path + "/";
%><html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gbk">
<script src="js/jquery-1.4.21.min.js" type="text/javascript">
</script><script >
function abid(){
alert("你大爷");
var rt=document.getElementById("rtl");
var pbid = "rt="+rt.value;
$.ajax{
type:"post",
url:"sexp2",
data:pbid,
susscess:function(list2,json){
${"#xuanze"}.html(pe);
}
}
// alert(rt.value);
//var op=rt.length;
//for(var i=1;i<op;i++){
//if(rt.options(i).selected)
// alert(rtl.options(i).selected.value);
// }
}
</script></head>
<body >
<div id="zhuanjia">
<select id="rtl">
<option value="0">
--请选择类别--
</option>
<c:forEach items="${list}" var="adp">
<option value="${adp.bid}">
${adp.bidname}
</option>
</c:forEach>
</select>
<input onclick="abid()" type="button" value="弹出下拉列表的值" >
</div><div id="xuanze">
<font color="#FF0033" size="4">候选专家</font>
<table id="zhuanjia1" class="tb">
<thead bgcolor="#DFDFDF">
<td>
选择
</td>
<td>
专家编号
</td>
<td>
名字
</td>
<td>
操作
</td>
</thead>
<tr>
<td>
<input type="checkbox" />
</td>
<td></td>
<td></td>
<td>
<input type="button" value="详细">
</tr>
</table>
<input type="button" value="确定" onclick="queding()">
</div>
<div id="zhuanjiaxinxi" class="div2">
专家姓名
<input class="tex" type="text" readonly="true" />
照片
<img src="">
</br>
性别
<input class="tex" type="text" />
</br>
年龄
<input class="tex" type="text" />
</br>
专业
<input class="tex" type="text" />
</br>
电子邮件
<input class="tex" type="text" />
</br>
学位
<input class="tex" type="text" />
</br>
</div> <div id="zhuanjia2">
<font color="#FF0033" size="4">已选专家</font>
<table id="zhuanjia1" class="tb">
<thead bgcolor="#DFDFDF">
<td>
选择
</td>
<td>
专家编号
</td>
<td>
名字
</td>
<td>
操作
</td>
</thead>
<tr>
<td></td>
<td></td>
<td></td>
<td>
<input type="button" value="删除">
</tr>
</table>
<input type="button" value="提交" onclick="submit1()">
</div>
</body>
</html>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme() + "://"
+ request.getServerName() + ":" + request.getServerPort()
+ path + "/";
%><html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gbk">
<script src="js/jquery-1.4.21.min.js" type="text/javascript">
</script><script >
function abid(){
alert("你大爷");
var rt=document.getElementById("rtl");
var pbid = "rt="+rt.value;
$.ajax{
type:"post",
url:"sexp2",
data:pbid,
susscess:function(list2,json){
${"#xuanze"}.html(pe);
}
}
// alert(rt.value);
//var op=rt.length;
//for(var i=1;i<op;i++){
//if(rt.options(i).selected)
// alert(rtl.options(i).selected.value);
// }
}
</script></head>
<body >
<div id="zhuanjia">
<select id="rtl">
<option value="0">
--请选择类别--
</option>
<c:forEach items="${list}" var="adp">
<option value="${adp.bid}">
${adp.bidname}
</option>
</c:forEach>
</select>
<input onclick="abid()" type="button" value="弹出下拉列表的值" >
</div><div id="xuanze">
<font color="#FF0033" size="4">候选专家</font>
<table id="zhuanjia1" class="tb">
<thead bgcolor="#DFDFDF">
<td>
选择
</td>
<td>
专家编号
</td>
<td>
名字
</td>
<td>
操作
</td>
</thead>
<tr>
<td>
<input type="checkbox" />
</td>
<td></td>
<td></td>
<td>
<input type="button" value="详细">
</tr>
</table>
<input type="button" value="确定" onclick="queding()">
</div>
<div id="zhuanjiaxinxi" class="div2">
专家姓名
<input class="tex" type="text" readonly="true" />
照片
<img src="">
</br>
性别
<input class="tex" type="text" />
</br>
年龄
<input class="tex" type="text" />
</br>
专业
<input class="tex" type="text" />
</br>
电子邮件
<input class="tex" type="text" />
</br>
学位
<input class="tex" type="text" />
</br>
</div> <div id="zhuanjia2">
<font color="#FF0033" size="4">已选专家</font>
<table id="zhuanjia1" class="tb">
<thead bgcolor="#DFDFDF">
<td>
选择
</td>
<td>
专家编号
</td>
<td>
名字
</td>
<td>
操作
</td>
</thead>
<tr>
<td></td>
<td></td>
<td></td>
<td>
<input type="button" value="删除">
</tr>
</table>
<input type="button" value="提交" onclick="submit1()">
</div>
</body>
</html>
$(document).ready(function () {
$("#saveDocument").click(function()
{
if(validateDocument($("#documentCreate")[0])==false){
return;
} $.post("<%=basePath%>secure/document/createSaveDocument", $("#documentCreate").serialize(), function(result)
{ });
});
});
</script>result是你从后台取到的数据
$(document).ready(function () {
$("#按钮id").click(function()
{ $.post("<%=basePath%>servlet路径", 提交参数, function(result)
{ });
});
});
</script>
type:"post",
url:"sexp2",
data:pbid,
dataType:'',
susscess:function(list2,json){
${"#xuanze"}.html(pe);
}
}参考ajax api文档:http://www.w3school.com.cn/jquery/ajax_ajax.asp dataType
类型:String预期服务器返回的数据类型。如果不指定,jQuery 将自动根据 HTTP 包 MIME 信息来智能判断,比如 XML MIME 类型就被识别为 XML。在 1.4 中,JSON 就会生成一个 JavaScript 对象,而 script 则会执行这个脚本。随后服务器端返回的数据会根据这个值解析后,传递给回调函数。可用值: •"xml": 返回 XML 文档,可用 jQuery 处理。
•"html": 返回纯文本 HTML 信息;包含的 script 标签会在插入 dom 时执行。
•"script": 返回纯文本 JavaScript 代码。不会自动缓存结果。除非设置了 "cache" 参数。注意:在远程请求时(不在同一个域下),所有 POST 请求都将转为 GET 请求。(因为将使用 DOM 的 script标签来加载)
•"json": 返回 JSON 数据 。
•"jsonp": JSONP 格式。使用 JSONP 形式调用函数时,如 "myurl?callback=?" jQuery 将自动替换 ? 为正确的函数名,以执行回调函数。
•"text": 返回纯文本字符串