title: ajax self invoked function to vue data
body: <p>I'm trying to use a <strong>self invoked function</strong> to do an ajax call.
  Later I want to use the response to populate a data property inside Vue, but for some reason I'm not able to do that.</p>
  
  <p><strong>Here is my code so far</strong></p>
  
  <pre><code>//chiamata Ajax a servizio
  var getData = (function(){
    var req = $.ajax({
      type:'get',
      url:'https://api.myjson.com/bins/a8ohr',
      dataType: 'json',
      success: function(response)
      {
        result =JSON.parse(response);
      }
    });
    return {
      getResponse:function(){
        return req.success;   
      }
    }
  }());
  
  var modello = getData.getResponse(); 
  </code></pre>
  
  <p>My goal is to pass <code>modello</code> as data in Vue.</p>
  
  <p><strong>Here the VUE:</strong></p>
  
  <pre><code>var Metromappa = new Vue({
    el: '#metromappa',
    data: {
      modello:modello
    },
    methods:{
  
    },
    beforeMount(){
      this.modello = modello;
    }
  })
  </code></pre>
  
  <p>What have I done wrong?</p>