DEV Community

Cover image for How to use PHP within JavaScript on the Laravel framework.
Mahfuzur Rahman
Mahfuzur Rahman

Posted on

How to use PHP within JavaScript on the Laravel framework.

Hey Laravel Devs πŸ“’
Do you know? You can use Laravel Blades

{{ }}
Enter fullscreen mode Exit fullscreen mode

in JS and use PHP variables in there.

Image description

Also, You Can Use Route In Ajax URL

Image description

But your JS must be in the Blade file inside the "script" tag.

Laravel #javascript

Top comments (0)