let name = $(this).attr("name"); let value = "{{ $response['" + name + "'] }}";
I am running this in $(document).ready()
2
Your code shouldn’t work, because the php code will only be compiled first and then returned to the client(haha,That’s correct, right?); Let js receive php variable value in blade
let value = `{{$a}}`;//`{{$a['hello']}}`
Larvel has a helper to include json to be used in js https://laravel.com/docs/9.x/blade#rendering-json
Click here to cancel reply.
2
Answers
Your code shouldn’t work, because the php code will only be compiled first and then returned to the client(haha,That’s correct, right?);
Let js receive php variable value in blade
Larvel has a helper to include json to be used in js https://laravel.com/docs/9.x/blade#rendering-json