In my code I am using typeahead.js. I use Laravel 5 and I need to replace the var states
with my {{ $jobs }}
variable. I need to list all Job Titles as an array.
In my controller I have
$jobs = Job::all(['job_title']);
I know the loop method in javascript but I dont know how to "link" my blade's variable in the javascript. Anyone knows how to?
I have tried, in my.js
var jobs = {{ $jobs }}
But that wont work.
See Question&Answers more detail:os