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

hjortur17's avatar

Hide query param in URL

Hi, I'm wondering if there is some way to hide the query params in URL when using Inertia Link?

For example I want to get all available cars with a click of a button, but I don't want the URL to look something like this: /cars?searchTerm[fromDate]=2022-08-18T21%3A47%3A43.112Z&searchTerm[fromTime]=12%3A00&searchTerm[toDate]=2022-08-18T21%3A47%3A43.112Z&searchTerm[toTime]=12%3A00

Is there some good work around this or even some Inertia magic I could use?

<Link href="/book/cars" :data="{ searchTerm }">
	Book now
</Link>
0 likes
2 replies
Tray2's avatar

The only way I know of is to use an Ajax call, that way the url never changes.

1 like
Sinnbeck's avatar
Sinnbeck
Best Answer
Level 102

You would need to do a post request with the data, set the data in session, redirect to the get route and extract the data from session

1 like

Please or to participate in this conversation.