I am using laravel and I got this error. What I want to achieve is getting coordinator id
and display it to input coordinatorname
. I am using for loop to get the data but it gives error about constant 'i'. Does anyone know how to fix this?
This is my Javascript code:
function defaultcoor(course)
{
for(let i=0; i < {{ count($codes) }}; i++)
{
for(let j=0;j < {{ count($coordinators) }}; j++)
{
if(course == {{ $codes[i]->id }} && {{ $coordinators[j]->staffid }} == {{ $codes[i]->coordinator_id }})
{
document.getElementById("coordinatorname").value = $coordinators[j]->id;
}
}
}
}