in controller I do this
$actions = array('' => 'Select Action Name') + Action::lists('name' , 'id');
I want to use that $actions
variable in my javascript.
I tried these ways:
<script>
var actions = {{actions}};
</script>
but I got this excpetion
Array to string conversion
I also tried this:
<script>
@foreach($actions as $action)
console.log($action);
@endforeach
</script>
but in the console I got this exception
Uncaught ReferenceError: $action is not defined
could you help me please?