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)

AWS Security LIVE!

Join us for AWS Security LIVE!

Discover the future of cloud security. Tune in live for trends, tips, and solutions from AWS and AWS Partners.

Learn More

πŸ‘‹ Kindness is contagious

Please leave a ❀️ or a friendly comment on this post if you found it helpful!

Okay