Search code examples
ajaxlaravel-5.3vuejs2

vue vf-form can't get ajax data


I have a problem with ajax from vue vf-form. I have wizard in this project as registration process. So every step I'have a different view. Code:

<wizard-hidden-step
                        title="About your company"
                        v-ref:head2
                        :valid="valid.step2"
                        :locked="isLocked"
                        :loading="isSending"
                >
                    @include('auth.steps.step2', ['action' => "/company/signup/step2"])

                </wizard-hidden-step>

                {{-- ====== STEP 3 - ADDITIONAL INFO ========= --}}
                <wizard-hidden-step
                        title="Additional information"
                        description="Add company additional info"
                        v-ref:head3
                        :valid="valid.step3"
                        :locked="isLocked"
                        :loading="isSending"
                >
                    @include('auth.steps.step3', ['action' => '/company/signup/step3'])

                </wizard-hidden-step>

And on all view I have a similar data but I will insert the code where i can't get ajax data:

<vf-form ajax
         action="{{ $action }}"
         method="POST"
         :validation="validation"
         v-ref:step2
>

PHP Laravel Controller:

return json_encode([ 'shared' => [ 'status' => 'ok', 'postcodes' => $postcodes ] ]);

After that I have ajax data in console (see on picture) but I can't set that data on view in vf-select:

<vf-select
                    :items="shared.postcodes"
                    multiple
                    select2
                    err-msg="Postcodes"
                    name="postcodes"
                    :html="true"
                    :value=""
                    v-ref:postcodes
                    :options="{showDropdowns: true, width: '100%'}"
            >
            </vf-select>

I have just No results found in vf-select. Please help me, I don't have idea what to do.


Solution

  • I've found solution. I was send shared object from backend and when I edit that in share, and on frontend read that as a shared this was work. I don't know how but it work...