passing php variable from controller to javascript function in the head of a view

前端 未结 3 1010
不知归路
不知归路 2020-11-27 08:59

I would pass two php variables from a codeigniter controller to a javascript function located to the head of my view. is it possible to do such thing?

3条回答
  •  北海茫月
    2020-11-27 09:10

    or just set in your controller your variables

    eg - in the controller

    $data['newvar'] = $myvar_in_the_controller;
    

    and then in the view in the javascript

    
    

提交回复
热议问题