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

kachi_dk's avatar

Inertia post request

After i make a post request, the page returns a blank page, but the post request was successful. I read the docs and it says i have to make a redirect after a non-get request in the controller.

I want to know if this practice is compulsory.

0 likes
2 replies
koramit's avatar
koramit
Best Answer
Level 9

Inertia request not quite like an ajax request.

When you make inertia request it expect a page response. Like when you submit a form, if success your need to return redirect back or redirect to another page.

So, If you use inertia and want to fetch data via an api you should use something else ie axios or the fetch api.

In my opinion, inertia post request more like traditional form submit than an ajax request posting data to the backend.

2 likes

Please or to participate in this conversation.