Feb 20, 2023
0
Level 2
Get contoller data on button click Inertia/ Vue3
I have following code to get data from controller but it only shows after page refresh:
public function firstStep(Request $request)
{
$id = Session::get('qid');
$self=false;
return to_route('questions.create', ['id'=>$id,'end'=>false,'self'=>$self]);
}
function nextStep() {
Inertia.post(
route("questions.first.step"),
{
category_id: form.category_id,
},
{
onSuccess: () => {
formStep.value++;
},
}
);
}
<form>
<BreezeButton
class="ml-4"
type="button"
@click="nextStep"
>
</form>
Please or to participate in this conversation.