jquery - How to call a javascript function from zend controller indexAction? -
i want call javascript function zend controller indexaction. controller this..
// mycontroller.php
public function indexaction(){ $role = 'admin'; $id = 23; // here want call javascript function /// myjsfun(role, id); } and viwefile controller //index.phtml
here javascript function <script type='text/javascript'> function myjsfun(role, id){ // code function }
//mycontroller.php
$role = 'admin'; $id = 23; $this->view->role = $role; $this->view->id = $id; //index.phtml
<script type='text/javascript'> function myjsfun(role, id){ // code function } //actual call: myjsfun(<?php echo zend_json::encode($this->role) ?>, <?php echo zend_json::encode($this->id) ?>); </script>
Comments
Post a Comment