本文主要包含html页面传递参数,html页面跳转传递参数,html页面间的数据传递,html页面传递数据,html页面获取参数等相关知识,提笔写忧伤希望在学习及工作中可以帮助到您
点击第一个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>

