Support the ongoing development of Laravel.io →
Input Blade Forms
Last updated 2 years ago.
0

I'm assuming $classification->todos returns related records. If so, it will be a collection of Eloquent objects, and Javascipt has no idea what those are or how to handle them. You need to pass a JS array to your function instead.

You could also look at something like: https://github.com/laracasts/PHP-Vars-To-Js-Transformer http://netsells.co.uk/blog/post/passing-data-to-your-javascript-in-laravel

Last updated 10 years ago.
0

Thanks, for answer. I got that object from a json object:

"classification" : {
	                  "label" : "ASK FOR SOMETHING",	                  
	                  "todos" : [
	                     "The first todo",
	                     "The second todo"
	                  ]
	               }

So, i can render the Label and the Todos in the view, but, i need to send the todos to an argument in a javascript function

Last updated 10 years ago.
0

Sign in to participate in this thread!

Eventy

Your banner here too?

jpilldev jpilldev Joined 28 Aug 2014

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 Laravel.io - All rights reserved.