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()
  • Hi,
    If js you are writing in view.edit.php you can assign the value $type_of_account directly to a javascript varible.

    $script=<<EOC
    <script type="text/javascript">
               //here we can use the $type_of_account variable directly
               var account_type='$type_of_account ';
    </script>
    EOC;


    I am not sure this is what you are asking for:)

Reply
  • Hi,
    If js you are writing in view.edit.php you can assign the value $type_of_account directly to a javascript varible.

    $script=<<EOC
    <script type="text/javascript">
               //here we can use the $type_of_account variable directly
               var account_type='$type_of_account ';
    </script>
    EOC;


    I am not sure this is what you are asking for:)

Children
No Data