My laravel controller is returning this data on the blade view using this command {{$employees}}
It gives me:
[{"id":"1","name":"june"},{"id":"2","name":"joan"}]
In my JavaScript:
<script>
var jsonData = $.parseJson('{{$employees}}');
alert(1);
</script>
But somehow it's throwing an error because the alert is not displaying.
Whats the workaround on these?
var jsonData = {{$employees}};? I don't know anything about laravel, but that should just output your data as a JavaScript array of objects, ready to use, no parsing necessary...