Pass PHP data to javascript on Laravel blade view

//src - https://stackoverflow.com/a/31201101

@section('content')

<script> 
var participantsfrom = {!! json_encode($activity->participantsfrom) !!};
</script>

//then variable #participantsfrom# is accessible from your JS

with addon – https://github.com/laracasts/PHP-Vars-To-Js-Transformer/blob/master/readme.md

By: |14/01/2020|categories: