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

muazzamazaz's avatar

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>
0 likes
0 replies

Please or to participate in this conversation.