title: How to return a response from axios in Vue
body: <p>I read all answered questions on stack overflow but still unable to figure out how to make this work. </p>
  
  <p><strong>File1.js</strong></p>
  
  <p>I send some data to server using axios ajax call as follows:</p>
  
  <pre><code>function ajaxSearchAxios(searchType,searchText){ 
      var searchResults=[];
      axios({
          method: 'post',
          url: 'ajaxSearch/',
          data: {
                searchType: searchType,
                searchText: searchText,
              },
          responseType: 'json',
        })
        .then ( function (response){
            searchResults = response.data['searchResults']; console.log('JS searchResults=',searchResults[0].value) //this prints nicely to the console
            return searchResults
  
        })
        .catch ( function (error){
          console.log('ajaxSearch error'); 
        });
  }
  </code></pre>
  
  <p><strong>File2.js</strong></p>
  
  <p>Here I have my Vue code where I want to take output of <code>ajaxSearchAxios()</code> and store in Vue data.</p>
  
  <pre><code>new Vue({
      el:'#id_1',
      data:{
              SearchResults:[],
      },
      methods:{
          ajaxSearch:function(searchType){
              this.SearchResults= ajaxSearchAxios('s','s1');
              console.log('VUE =',this.SearchResults[0].value)
          },
      },
  });
  </code></pre>
  
  <p>Thanks</p>