php - Passing controller variable to javascript -
php - Passing controller variable to javascript -
i have code have variable , javascript in controller
function detailed_control() { $data = array( "historical_table" => 1, "page_javascript" => "assets/javascript/employeedetail_js.php", ); $this->load->view('employeedetail_load',$data); } i want in employeedetail_js javascript display $historical_table have value of 1
my 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'); ?> i can load javascript want include variable $historical_table js
first set $historical_table employeedetail_load view file in div , can hidden div
then in employeedetail_js javascript file write jquery code extract $historical_table value div , on onload event or document ready event employeedetail_js javascript file like
$(document).load(function(){ var value = $('#div').val(); $('#wher_valu_be_put').val(value); }); javascript php
Comments
Post a Comment