Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

Lucious123's avatar

Send Values from JavaScript to a Blade File

Hello, everyone!

I’m working on a Laravel project and need help with sending values from JavaScript to a Blade file. Here's my situation:

I have a Blade file named calculate_delivery_booking.blade.php, where users can calculate delivery costs. The flow works as follows:

Users select a state, which dynamically loads cities related to the selected state into a city dropdown. Then, users select the delivery city, receiver city, weight, and price. I’ve implemented this functionality in the calculate_delivery_booking.blade.php page.

Now, I want to allow users to calculate delivery costs directly from the home page. This involves three dropdowns:

State Delivery city Weight When the user selects values and clicks a Calculate button on the home page, these values should be sent to the calculate_delivery_booking.blade.php page to display the results.

How can I send the selected values from the JavaScript in the home page to the calculate_delivery_booking.blade.php file? Should I use query parameters in the URL, or is there a better way to pass the data between pages? Any guidance or examples on how to achieve this would be greatly appreciated!

0 likes
1 reply
Snapey's avatar
Snapey
Best Answer
Level 122

Laravel Livewire is your best bet for this

1 like

Please or to participate in this conversation.