html页面跳转及参数传递

来源:互联网 发布:远洋数据推销什么 编辑:程序博客网 时间:2024/05/19 14:38

点击第一个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_scenevar SCENE_id = APP_scene["scene_id"]; //获取传递的scene_id</script></body></html>



原创粉丝点击