Note: using the Laravel framework but the concept shouldn't be too different.
How would I go about passing my $data['method'] and $data['id] to javascript?
<div id="player" data-method="{{ $data['method'] }}" data-id="{{ $data['id'] }}"></div>
Data method and Data id are passed through a controller.
In javascript I've currently got
var method = "<?php echo $data-id[]>";
var id = "<?php echo $data-method[]>";
Which obviously don't work
echo $data-method[]? The[]is normally used to push data to an array.