How to pass PHP variable value to javascript variable in view.edit.php?

Hello everyone, I want to pass $bean->id value of Case module to a javascript variable in view.edit.php file of "Case" module. I want to know, whether it is possible without using AJAX and if it is, then I would like to know, HOW TO?
Parents
  • I assume the JavaScript is for edit view

    The current record id is available in a hidden field called record

    you can retrieve it in your JavaScript using $('[name="record"]').val()
  • if I am  using that javascript variable in alert function, it doesn't show me that value of php variable after assigning php variable to javascript variable. This my script

    $script=<<EOC
    <script type="text/javascript">
               var bn='$bean';
               alert(bn);
    </script>
    EOC;

    I am getting blank alert......???
Reply
  • if I am  using that javascript variable in alert function, it doesn't show me that value of php variable after assigning php variable to javascript variable. This my script

    $script=<<EOC
    <script type="text/javascript">
               var bn='$bean';
               alert(bn);
    </script>
    EOC;

    I am getting blank alert......???
Children
No Data