您的位置:首页 > Web前端 > HTML

html页面跳转及参数传递

2017-08-26 15:08 393 查看
点击第一个html页面上 table数据的一行,跳转到第二个html页面显示这个场景下的详细数据,跳转过去时需要把这行数据的id传递给第二个html页面

1. 第一个html页面代码

// table点击事件
$('#table').on('click-row.bs.table', function (e, row, $element, field) {
if(field == "scene_name" || field == "scene"){
var index = $('#table').bootstrapTable('getSelections')[0]; //获取用户选择的行
if(typeof(index) == "undefined"){
alert("请选择一行数据");
}else{
var sceneid = index.id;
var exptscene = index.scene;
location.href = "get_template?template=recalltactic.html¶ms={\"APP_scene\":{\"scene_id\":\"" + sceneid + "\"}}"; //跳转到recalltactic.html页面,跳转参数放在params里
}

}
});


2.第二个html页面代码

{% set APP_scene = params['APP_scene'] %} //获取页面传递的参数params
<!DOCTYPE html>
<html>
<head>
</head>
<body>
<script type="application/javascript">
var APP_scene = { {% for APP in APP_scene %} "{{APP}}": "{{APP_scene[APP]}}", {% end %} }; //tornado模版,解析APP_scene
var SCENE_id = APP_scene["scene_id"]; //获取传递的scene_id
</script>
</body>
</html>
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: