我有这个代码,在控制器中有一个变量和一个javascript
function detailed_control() {
$data = array(
"historical_table" => 1,
"page_javascript" => "assets/javascript/employeedetail_js.php",
);
$this->load->view('employeedetail_load',$data);
}
我希望在employeedetail_js javascript中显示值为1的$ historical_table
我的employeedetail_load就是这个
<?php
require_once("assets/includes.php");
require_once($page_javascript);
include('assets/template/side.php');
include('assets/template/header_new.php');
include('employeedetail_view.php');
include('assets/template/footer_new.php');
?>
我已经可以加载我的javascript但我想将我的变量$ historical_table包含到我的js
中答案 0 :(得分:0)
然后在employeedetail_js javascript文件中,您将编写一个jquery代码,从DIV中提取$ historical_table值,onload事件或文档就绪事件employeedetail_js javascript文件就像
$(document).load(function(){
var value = $('#div').val();
$('#wher_valu_be_put').val(value);
});