JSP父页面传参数到子页面及接收示例
程序员文章站
2022-06-20 08:01:24
1、父页面传参数到子页面 复制代码 代码如下: //javascript代码 $.ajax({ type:"post", uri:"../student/studentin...
1、父页面传参数到子页面
//javascript代码
$.ajax({
type:"post",
uri:"../student/studentinfo.action",
data:{
"date":date,
"stuno":stuno
},
success:function(data){
var params = "?date="+date+"&stuno="+stuno;
var action = '../../page/studentinfo.jsp?'+params;
dojo.byid("student").src = action;
}
});
<iframe src="../../page/studentinfo.jsp" id="student" ></iframe>
2、子页面接受父页面的参数
var params = {
'date':'{param.date}',
'stuno':{param.stuno}
};
复制代码 代码如下:
//javascript代码
$.ajax({
type:"post",
uri:"../student/studentinfo.action",
data:{
"date":date,
"stuno":stuno
},
success:function(data){
var params = "?date="+date+"&stuno="+stuno;
var action = '../../page/studentinfo.jsp?'+params;
dojo.byid("student").src = action;
}
});
复制代码 代码如下:
<iframe src="../../page/studentinfo.jsp" id="student" ></iframe>
2、子页面接受父页面的参数
复制代码 代码如下:
var params = {
'date':'{param.date}',
'stuno':{param.stuno}
};