-3

I have a controller which is returning an array. I am using foreach loop in the blade to show the data individually. For eg.

@foreach($a as $b)
{print_r($b)
}

So, it gives me the values correctly. Now, I have a jquery function written in a separate JS file, abc.js. So, can I call this function in the foreach loop here?

Note: I don't want to call this function inside

Rob
  • 2,086
  • 18
  • 25
  • http://stackoverflow.com/questions/13840429/what-is-the-difference-between-client-side-and-server-side-programming – Teemu May 21 '18 at 18:00

1 Answers1

0

No, you can not, and eve if you can you should not do it. Is better save whatever variable in php or js side and use those variables in common way to communicate php with js. I recommend you use input hidden to store in data attribute the information or make an ajax call to get the information.

Marco Feregrino
  • 665
  • 5
  • 15