Cannot get Ajax result from a Vue method to data()s returned variablesjQuery: Return data after ajax call successHow do I pass variables and data from PHP to JavaScript?How do I pass AJAX data from a Vue instance to a component?Class import into Vue componentHow to display API data using Nativescript Vue and AxiosModifying child data from parent vueInvalid argument Supplied for foreach() Axios LaravelHow To Submit Form Data From B-modal In VueWhere/How to define a submit destination for my self created form (Vue) component?Using $emit from child component to send data to the parent component doesn't work with Vue

"Literally" Vs "In the true sense of the word"

In Germany, how can I maximize the impact of my charitable donations?

Why island and not light?

Where does the expression "triple-A" come from?

What is this unknown executable on my boot volume? Is it Malicious?

I asked for a graduate student position from a professor. He replied "welcome". What does that mean?

What are uses of the byte after BRK instruction on 6502?

Is it appropriate for a professor to require students to sign a non-disclosure agreement before being taught?

Do ibuprofen or paracetamol cause hearing loss?

Can I disable a battery powered device by reversing half of its batteries?

Evidence that matrix multiplication cannot be done in O(n^2 poly(log(n))) time

Align equations to start in the same position

Do all humans have an identical nucleotide sequence for certain proteins, e.g haemoglobin?

How to say "quirky" in German without sounding derogatory?

Do they still use tiger roars in the 2019 "Lion King" movie?

Relocation error, error code (127) after last updates

Are scroll bars dead in 2019?

Why is the T-1000 humanoid?

What is my breathable atmosphere composed of?

Does a gnoll speak both Gnoll and Abyssal, or is Gnoll a dialect of Abyssal?

What jurisdiction do Scottish courts have over the Westminster parliament?

Does an oscilloscope subtract voltages as phasors?

Job offer without any details but asking me to withdraw other applications - is it normal?

Can I toggle Do Not Disturb on/off on my Mac as easily as I can on my iPhone?



Cannot get Ajax result from a Vue method to data()s returned variables


jQuery: Return data after ajax call successHow do I pass variables and data from PHP to JavaScript?How do I pass AJAX data from a Vue instance to a component?Class import into Vue componentHow to display API data using Nativescript Vue and AxiosModifying child data from parent vueInvalid argument Supplied for foreach() Axios LaravelHow To Submit Form Data From B-modal In VueWhere/How to define a submit destination for my self created form (Vue) component?Using $emit from child component to send data to the parent component doesn't work with Vue






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








0















I have this component, I have just started working with components until this point where there I am trying to fetch data via ajax, when console.loging inside the method - I get the actual result, but the result isn't returned.



  1. What is it that I'm not understanding (In vanilla js when doing the same from an object, it works fine.. so why in Vue it doesn't work? What's the reason from behind the scenes?)


  2. How can I fetch data using $.ajax?


  3. What are my other alternatives and why? (I know of Axio, never used it, not sure why to use it if I can use fetch, which btw, fetch didn't work for me too - that's why I went back to $.ajax).



index.js



import Vue from 'vue';
import VueRouter from 'vue-router';
import axios from 'axios';
import VueAxios from 'vue-axios'

Vue.use(VueRouter);
Vue.use(VueAxios, axios);

const Dashboard_testcomponent = () => import('../vue/dashboard/test/testcomponent.vue');


let routes = [

path: '/main',
component: Dashboard,
children: [

path: 'testcomponent',
component: Dashboard_testcomponent

]

];


window.router = new VueRouter(
mode: 'history',
routes
);



testcomponent.vue:



<script>
import Form from "../../components/Form.vue";
import Tabs from "../../components/Tabs.vue";

export default {
name: 'testcomponent',
components:
Form,
Tabs
,
data()
return
reportType: 'testreport',
dates: ,
list:

,
created()
,
mounted()
,
destroyed()
,
watch:
,
methods:
// Submit form
formSubmit: function(data)
console.log('Submit form here');
console.log(data);

// SetLoader();

this.list = this.getList();
console.log(this.getList());
console.log(this.List);
,
// Fetch List By List type
getList: function()

axios.post('/call/api/getList',
'reportType': this.reportType
)
.then(function (response)
if (response.status === true)
console.log(response);
return response.data;

)
.catch(function (error)
console.log(error);
);





</scrip1t>


<templat e>

<Form
:useGroupFilter="true"
:useDateRange="true"
@submit="formSubmit"
/>


</template>









share|improve this question





















  • 1





    if u r using jquery ajax, u need to install and import it in your component. U might also need to add it as a plugin. Did u do all that?

    – Teddy McZieuwa
    Mar 28 at 9:51






  • 1





    I recommend you to use Axios with Vue.js . It's way easier to manage. vuejs.org/v2/cookbook/using-axios-to-consume-apis.html

    – Hadrien Delphin
    Mar 28 at 9:54












  • @TeddyMcZieuwa Done that, jquery works well

    – wellhellothere
    Mar 28 at 10:57











  • please post your error log also

    – Vignesh
    Mar 28 at 11:24

















0















I have this component, I have just started working with components until this point where there I am trying to fetch data via ajax, when console.loging inside the method - I get the actual result, but the result isn't returned.



  1. What is it that I'm not understanding (In vanilla js when doing the same from an object, it works fine.. so why in Vue it doesn't work? What's the reason from behind the scenes?)


  2. How can I fetch data using $.ajax?


  3. What are my other alternatives and why? (I know of Axio, never used it, not sure why to use it if I can use fetch, which btw, fetch didn't work for me too - that's why I went back to $.ajax).



index.js



import Vue from 'vue';
import VueRouter from 'vue-router';
import axios from 'axios';
import VueAxios from 'vue-axios'

Vue.use(VueRouter);
Vue.use(VueAxios, axios);

const Dashboard_testcomponent = () => import('../vue/dashboard/test/testcomponent.vue');


let routes = [

path: '/main',
component: Dashboard,
children: [

path: 'testcomponent',
component: Dashboard_testcomponent

]

];


window.router = new VueRouter(
mode: 'history',
routes
);



testcomponent.vue:



<script>
import Form from "../../components/Form.vue";
import Tabs from "../../components/Tabs.vue";

export default {
name: 'testcomponent',
components:
Form,
Tabs
,
data()
return
reportType: 'testreport',
dates: ,
list:

,
created()
,
mounted()
,
destroyed()
,
watch:
,
methods:
// Submit form
formSubmit: function(data)
console.log('Submit form here');
console.log(data);

// SetLoader();

this.list = this.getList();
console.log(this.getList());
console.log(this.List);
,
// Fetch List By List type
getList: function()

axios.post('/call/api/getList',
'reportType': this.reportType
)
.then(function (response)
if (response.status === true)
console.log(response);
return response.data;

)
.catch(function (error)
console.log(error);
);





</scrip1t>


<templat e>

<Form
:useGroupFilter="true"
:useDateRange="true"
@submit="formSubmit"
/>


</template>









share|improve this question





















  • 1





    if u r using jquery ajax, u need to install and import it in your component. U might also need to add it as a plugin. Did u do all that?

    – Teddy McZieuwa
    Mar 28 at 9:51






  • 1





    I recommend you to use Axios with Vue.js . It's way easier to manage. vuejs.org/v2/cookbook/using-axios-to-consume-apis.html

    – Hadrien Delphin
    Mar 28 at 9:54












  • @TeddyMcZieuwa Done that, jquery works well

    – wellhellothere
    Mar 28 at 10:57











  • please post your error log also

    – Vignesh
    Mar 28 at 11:24













0












0








0








I have this component, I have just started working with components until this point where there I am trying to fetch data via ajax, when console.loging inside the method - I get the actual result, but the result isn't returned.



  1. What is it that I'm not understanding (In vanilla js when doing the same from an object, it works fine.. so why in Vue it doesn't work? What's the reason from behind the scenes?)


  2. How can I fetch data using $.ajax?


  3. What are my other alternatives and why? (I know of Axio, never used it, not sure why to use it if I can use fetch, which btw, fetch didn't work for me too - that's why I went back to $.ajax).



index.js



import Vue from 'vue';
import VueRouter from 'vue-router';
import axios from 'axios';
import VueAxios from 'vue-axios'

Vue.use(VueRouter);
Vue.use(VueAxios, axios);

const Dashboard_testcomponent = () => import('../vue/dashboard/test/testcomponent.vue');


let routes = [

path: '/main',
component: Dashboard,
children: [

path: 'testcomponent',
component: Dashboard_testcomponent

]

];


window.router = new VueRouter(
mode: 'history',
routes
);



testcomponent.vue:



<script>
import Form from "../../components/Form.vue";
import Tabs from "../../components/Tabs.vue";

export default {
name: 'testcomponent',
components:
Form,
Tabs
,
data()
return
reportType: 'testreport',
dates: ,
list:

,
created()
,
mounted()
,
destroyed()
,
watch:
,
methods:
// Submit form
formSubmit: function(data)
console.log('Submit form here');
console.log(data);

// SetLoader();

this.list = this.getList();
console.log(this.getList());
console.log(this.List);
,
// Fetch List By List type
getList: function()

axios.post('/call/api/getList',
'reportType': this.reportType
)
.then(function (response)
if (response.status === true)
console.log(response);
return response.data;

)
.catch(function (error)
console.log(error);
);





</scrip1t>


<templat e>

<Form
:useGroupFilter="true"
:useDateRange="true"
@submit="formSubmit"
/>


</template>









share|improve this question
















I have this component, I have just started working with components until this point where there I am trying to fetch data via ajax, when console.loging inside the method - I get the actual result, but the result isn't returned.



  1. What is it that I'm not understanding (In vanilla js when doing the same from an object, it works fine.. so why in Vue it doesn't work? What's the reason from behind the scenes?)


  2. How can I fetch data using $.ajax?


  3. What are my other alternatives and why? (I know of Axio, never used it, not sure why to use it if I can use fetch, which btw, fetch didn't work for me too - that's why I went back to $.ajax).



index.js



import Vue from 'vue';
import VueRouter from 'vue-router';
import axios from 'axios';
import VueAxios from 'vue-axios'

Vue.use(VueRouter);
Vue.use(VueAxios, axios);

const Dashboard_testcomponent = () => import('../vue/dashboard/test/testcomponent.vue');


let routes = [

path: '/main',
component: Dashboard,
children: [

path: 'testcomponent',
component: Dashboard_testcomponent

]

];


window.router = new VueRouter(
mode: 'history',
routes
);



testcomponent.vue:



<script>
import Form from "../../components/Form.vue";
import Tabs from "../../components/Tabs.vue";

export default {
name: 'testcomponent',
components:
Form,
Tabs
,
data()
return
reportType: 'testreport',
dates: ,
list:

,
created()
,
mounted()
,
destroyed()
,
watch:
,
methods:
// Submit form
formSubmit: function(data)
console.log('Submit form here');
console.log(data);

// SetLoader();

this.list = this.getList();
console.log(this.getList());
console.log(this.List);
,
// Fetch List By List type
getList: function()

axios.post('/call/api/getList',
'reportType': this.reportType
)
.then(function (response)
if (response.status === true)
console.log(response);
return response.data;

)
.catch(function (error)
console.log(error);
);





</scrip1t>


<templat e>

<Form
:useGroupFilter="true"
:useDateRange="true"
@submit="formSubmit"
/>


</template>






javascript ajax vue.js vuejs2 vue-component






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Mar 28 at 12:24







wellhellothere

















asked Mar 28 at 9:46









wellhellotherewellhellothere

226 bronze badges




226 bronze badges










  • 1





    if u r using jquery ajax, u need to install and import it in your component. U might also need to add it as a plugin. Did u do all that?

    – Teddy McZieuwa
    Mar 28 at 9:51






  • 1





    I recommend you to use Axios with Vue.js . It's way easier to manage. vuejs.org/v2/cookbook/using-axios-to-consume-apis.html

    – Hadrien Delphin
    Mar 28 at 9:54












  • @TeddyMcZieuwa Done that, jquery works well

    – wellhellothere
    Mar 28 at 10:57











  • please post your error log also

    – Vignesh
    Mar 28 at 11:24












  • 1





    if u r using jquery ajax, u need to install and import it in your component. U might also need to add it as a plugin. Did u do all that?

    – Teddy McZieuwa
    Mar 28 at 9:51






  • 1





    I recommend you to use Axios with Vue.js . It's way easier to manage. vuejs.org/v2/cookbook/using-axios-to-consume-apis.html

    – Hadrien Delphin
    Mar 28 at 9:54












  • @TeddyMcZieuwa Done that, jquery works well

    – wellhellothere
    Mar 28 at 10:57











  • please post your error log also

    – Vignesh
    Mar 28 at 11:24







1




1





if u r using jquery ajax, u need to install and import it in your component. U might also need to add it as a plugin. Did u do all that?

– Teddy McZieuwa
Mar 28 at 9:51





if u r using jquery ajax, u need to install and import it in your component. U might also need to add it as a plugin. Did u do all that?

– Teddy McZieuwa
Mar 28 at 9:51




1




1





I recommend you to use Axios with Vue.js . It's way easier to manage. vuejs.org/v2/cookbook/using-axios-to-consume-apis.html

– Hadrien Delphin
Mar 28 at 9:54






I recommend you to use Axios with Vue.js . It's way easier to manage. vuejs.org/v2/cookbook/using-axios-to-consume-apis.html

– Hadrien Delphin
Mar 28 at 9:54














@TeddyMcZieuwa Done that, jquery works well

– wellhellothere
Mar 28 at 10:57





@TeddyMcZieuwa Done that, jquery works well

– wellhellothere
Mar 28 at 10:57













please post your error log also

– Vignesh
Mar 28 at 11:24





please post your error log also

– Vignesh
Mar 28 at 11:24












2 Answers
2






active

oldest

votes


















0
















In you code getList is not returning anything, because axios.post is async function and executes later.
You should assign response data in .then callback.
Something like:



getList: function() 
axios.post('/call/api/getList',
'reportType': this.reportType
)
.then(function (response)
// if (response.status === true) (if 'then' fired means that it succeeded already)
console.log(response);
this.list = response.data;
//
)
.catch(function (error)
console.log(error);
);






share|improve this answer
































    0
















    Install Axios for in your project directory



    $ npm install axios


    import in app.js or in the component which you want



    <script>
    //optional import for individual component
    import axios from "axios";
    </script>

    //if you have imported in app.js
    Vue.use(axios);


    then make axios call like:



     let reqData = 
    p_Params1: '',
    p_Params2: '',
    p_Params3...: ''
    ;

    axios(
    method: "post",
    url: "http://127.0.0.1/sample_sub/sample.ext",
    crossdomain: true,
    data: $.param(reqData),
    headers:
    "Content-Type": "application/x-www-form-urlencoded"

    )
    .then(response =>
    //your resposne here
    )
    .catch(error => console.log(error));


    Note! by default axios does not parse the data to json so use $.param






    share|improve this answer



























    • which doesn't really answer #3. and doesn't answer #2 at all :(

      – wellhellothere
      Mar 28 at 10:57











    • did you import ajax in your project? then it should have worked or check your import

      – Vignesh
      Mar 28 at 11:07











    • and by default vue recommend using axois for netrwork calls so give a shot for it, and it is very simple and easy like ajax

      – Vignesh
      Mar 28 at 11:09











    • but why use that and not fetch?

      – wellhellothere
      Mar 28 at 11:12











    • fetch are saying fetch api or Ajax?

      – Vignesh
      Mar 28 at 11:18













    Your Answer






    StackExchange.ifUsing("editor", function ()
    StackExchange.using("externalEditor", function ()
    StackExchange.using("snippets", function ()
    StackExchange.snippets.init();
    );
    );
    , "code-snippets");

    StackExchange.ready(function()
    var channelOptions =
    tags: "".split(" "),
    id: "1"
    ;
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function()
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled)
    StackExchange.using("snippets", function()
    createEditor();
    );

    else
    createEditor();

    );

    function createEditor()
    StackExchange.prepareEditor(
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader:
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/4.0/"u003ecc by-sa 4.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    ,
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    );



    );














    draft saved

    draft discarded
















    StackExchange.ready(
    function ()
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55394492%2fcannot-get-ajax-result-from-a-vue-method-to-datas-returned-variables%23new-answer', 'question_page');

    );

    Post as a guest















    Required, but never shown

























    2 Answers
    2






    active

    oldest

    votes








    2 Answers
    2






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    0
















    In you code getList is not returning anything, because axios.post is async function and executes later.
    You should assign response data in .then callback.
    Something like:



    getList: function() 
    axios.post('/call/api/getList',
    'reportType': this.reportType
    )
    .then(function (response)
    // if (response.status === true) (if 'then' fired means that it succeeded already)
    console.log(response);
    this.list = response.data;
    //
    )
    .catch(function (error)
    console.log(error);
    );






    share|improve this answer





























      0
















      In you code getList is not returning anything, because axios.post is async function and executes later.
      You should assign response data in .then callback.
      Something like:



      getList: function() 
      axios.post('/call/api/getList',
      'reportType': this.reportType
      )
      .then(function (response)
      // if (response.status === true) (if 'then' fired means that it succeeded already)
      console.log(response);
      this.list = response.data;
      //
      )
      .catch(function (error)
      console.log(error);
      );






      share|improve this answer



























        0














        0










        0









        In you code getList is not returning anything, because axios.post is async function and executes later.
        You should assign response data in .then callback.
        Something like:



        getList: function() 
        axios.post('/call/api/getList',
        'reportType': this.reportType
        )
        .then(function (response)
        // if (response.status === true) (if 'then' fired means that it succeeded already)
        console.log(response);
        this.list = response.data;
        //
        )
        .catch(function (error)
        console.log(error);
        );






        share|improve this answer













        In you code getList is not returning anything, because axios.post is async function and executes later.
        You should assign response data in .then callback.
        Something like:



        getList: function() 
        axios.post('/call/api/getList',
        'reportType': this.reportType
        )
        .then(function (response)
        // if (response.status === true) (if 'then' fired means that it succeeded already)
        console.log(response);
        this.list = response.data;
        //
        )
        .catch(function (error)
        console.log(error);
        );







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Mar 28 at 14:15









        Vitaliy BlagovVitaliy Blagov

        164 bronze badges




        164 bronze badges


























            0
















            Install Axios for in your project directory



            $ npm install axios


            import in app.js or in the component which you want



            <script>
            //optional import for individual component
            import axios from "axios";
            </script>

            //if you have imported in app.js
            Vue.use(axios);


            then make axios call like:



             let reqData = 
            p_Params1: '',
            p_Params2: '',
            p_Params3...: ''
            ;

            axios(
            method: "post",
            url: "http://127.0.0.1/sample_sub/sample.ext",
            crossdomain: true,
            data: $.param(reqData),
            headers:
            "Content-Type": "application/x-www-form-urlencoded"

            )
            .then(response =>
            //your resposne here
            )
            .catch(error => console.log(error));


            Note! by default axios does not parse the data to json so use $.param






            share|improve this answer



























            • which doesn't really answer #3. and doesn't answer #2 at all :(

              – wellhellothere
              Mar 28 at 10:57











            • did you import ajax in your project? then it should have worked or check your import

              – Vignesh
              Mar 28 at 11:07











            • and by default vue recommend using axois for netrwork calls so give a shot for it, and it is very simple and easy like ajax

              – Vignesh
              Mar 28 at 11:09











            • but why use that and not fetch?

              – wellhellothere
              Mar 28 at 11:12











            • fetch are saying fetch api or Ajax?

              – Vignesh
              Mar 28 at 11:18















            0
















            Install Axios for in your project directory



            $ npm install axios


            import in app.js or in the component which you want



            <script>
            //optional import for individual component
            import axios from "axios";
            </script>

            //if you have imported in app.js
            Vue.use(axios);


            then make axios call like:



             let reqData = 
            p_Params1: '',
            p_Params2: '',
            p_Params3...: ''
            ;

            axios(
            method: "post",
            url: "http://127.0.0.1/sample_sub/sample.ext",
            crossdomain: true,
            data: $.param(reqData),
            headers:
            "Content-Type": "application/x-www-form-urlencoded"

            )
            .then(response =>
            //your resposne here
            )
            .catch(error => console.log(error));


            Note! by default axios does not parse the data to json so use $.param






            share|improve this answer



























            • which doesn't really answer #3. and doesn't answer #2 at all :(

              – wellhellothere
              Mar 28 at 10:57











            • did you import ajax in your project? then it should have worked or check your import

              – Vignesh
              Mar 28 at 11:07











            • and by default vue recommend using axois for netrwork calls so give a shot for it, and it is very simple and easy like ajax

              – Vignesh
              Mar 28 at 11:09











            • but why use that and not fetch?

              – wellhellothere
              Mar 28 at 11:12











            • fetch are saying fetch api or Ajax?

              – Vignesh
              Mar 28 at 11:18













            0














            0










            0









            Install Axios for in your project directory



            $ npm install axios


            import in app.js or in the component which you want



            <script>
            //optional import for individual component
            import axios from "axios";
            </script>

            //if you have imported in app.js
            Vue.use(axios);


            then make axios call like:



             let reqData = 
            p_Params1: '',
            p_Params2: '',
            p_Params3...: ''
            ;

            axios(
            method: "post",
            url: "http://127.0.0.1/sample_sub/sample.ext",
            crossdomain: true,
            data: $.param(reqData),
            headers:
            "Content-Type": "application/x-www-form-urlencoded"

            )
            .then(response =>
            //your resposne here
            )
            .catch(error => console.log(error));


            Note! by default axios does not parse the data to json so use $.param






            share|improve this answer















            Install Axios for in your project directory



            $ npm install axios


            import in app.js or in the component which you want



            <script>
            //optional import for individual component
            import axios from "axios";
            </script>

            //if you have imported in app.js
            Vue.use(axios);


            then make axios call like:



             let reqData = 
            p_Params1: '',
            p_Params2: '',
            p_Params3...: ''
            ;

            axios(
            method: "post",
            url: "http://127.0.0.1/sample_sub/sample.ext",
            crossdomain: true,
            data: $.param(reqData),
            headers:
            "Content-Type": "application/x-www-form-urlencoded"

            )
            .then(response =>
            //your resposne here
            )
            .catch(error => console.log(error));


            Note! by default axios does not parse the data to json so use $.param







            share|improve this answer














            share|improve this answer



            share|improve this answer








            edited Mar 29 at 5:11

























            answered Mar 28 at 10:35









            VigneshVignesh

            1391 silver badge12 bronze badges




            1391 silver badge12 bronze badges















            • which doesn't really answer #3. and doesn't answer #2 at all :(

              – wellhellothere
              Mar 28 at 10:57











            • did you import ajax in your project? then it should have worked or check your import

              – Vignesh
              Mar 28 at 11:07











            • and by default vue recommend using axois for netrwork calls so give a shot for it, and it is very simple and easy like ajax

              – Vignesh
              Mar 28 at 11:09











            • but why use that and not fetch?

              – wellhellothere
              Mar 28 at 11:12











            • fetch are saying fetch api or Ajax?

              – Vignesh
              Mar 28 at 11:18

















            • which doesn't really answer #3. and doesn't answer #2 at all :(

              – wellhellothere
              Mar 28 at 10:57











            • did you import ajax in your project? then it should have worked or check your import

              – Vignesh
              Mar 28 at 11:07











            • and by default vue recommend using axois for netrwork calls so give a shot for it, and it is very simple and easy like ajax

              – Vignesh
              Mar 28 at 11:09











            • but why use that and not fetch?

              – wellhellothere
              Mar 28 at 11:12











            • fetch are saying fetch api or Ajax?

              – Vignesh
              Mar 28 at 11:18
















            which doesn't really answer #3. and doesn't answer #2 at all :(

            – wellhellothere
            Mar 28 at 10:57





            which doesn't really answer #3. and doesn't answer #2 at all :(

            – wellhellothere
            Mar 28 at 10:57













            did you import ajax in your project? then it should have worked or check your import

            – Vignesh
            Mar 28 at 11:07





            did you import ajax in your project? then it should have worked or check your import

            – Vignesh
            Mar 28 at 11:07













            and by default vue recommend using axois for netrwork calls so give a shot for it, and it is very simple and easy like ajax

            – Vignesh
            Mar 28 at 11:09





            and by default vue recommend using axois for netrwork calls so give a shot for it, and it is very simple and easy like ajax

            – Vignesh
            Mar 28 at 11:09













            but why use that and not fetch?

            – wellhellothere
            Mar 28 at 11:12





            but why use that and not fetch?

            – wellhellothere
            Mar 28 at 11:12













            fetch are saying fetch api or Ajax?

            – Vignesh
            Mar 28 at 11:18





            fetch are saying fetch api or Ajax?

            – Vignesh
            Mar 28 at 11:18


















            draft saved

            draft discarded















































            Thanks for contributing an answer to Stack Overflow!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid


            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.

            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55394492%2fcannot-get-ajax-result-from-a-vue-method-to-datas-returned-variables%23new-answer', 'question_page');

            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            Kamusi Yaliyomo Aina za kamusi | Muundo wa kamusi | Faida za kamusi | Dhima ya picha katika kamusi | Marejeo | Tazama pia | Viungo vya nje | UrambazajiKuhusu kamusiGo-SwahiliWiki-KamusiKamusi ya Kiswahili na Kiingerezakuihariri na kuongeza habari

            Swift 4 - func physicsWorld not invoked on collision? The Next CEO of Stack OverflowHow to call Objective-C code from Swift#ifdef replacement in the Swift language@selector() in Swift?#pragma mark in Swift?Swift for loop: for index, element in array?dispatch_after - GCD in Swift?Swift Beta performance: sorting arraysSplit a String into an array in Swift?The use of Swift 3 @objc inference in Swift 4 mode is deprecated?How to optimize UITableViewCell, because my UITableView lags

            Access current req object everywhere in Node.js ExpressWhy are global variables considered bad practice? (node.js)Using req & res across functionsHow do I get the path to the current script with Node.js?What is Node.js' Connect, Express and “middleware”?Node.js w/ express error handling in callbackHow to access the GET parameters after “?” in Express?Modify Node.js req object parametersAccess “app” variable inside of ExpressJS/ConnectJS middleware?Node.js Express app - request objectAngular Http Module considered middleware?Session variables in ExpressJSAdd properties to the req object in expressjs with Typescript