0
let name = $(this).attr("name");
let value = "{{ $response['" + name + "'] }}";

I am running this in $(document).ready()

2 Answers 2

1

Larvel has a helper to include json to be used in js https://laravel.com/docs/9.x/blade#rendering-json

Sign up to request clarification or add additional context in comments.

1 Comment

The part you gave me helped me when I was having trouble getting an array of json data. I appreciate it very much.
0

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']}}`

2 Comments

Thank you for your response. I understand. Is it possible to expand all the data received and search for data in JS? I will try that.
Yes, I am. I have successfully solved the problem. Thank you very much.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.