title: Initializing Vue data with AJAX
body: <p>I'm trying to populate a Vue with data from the <code>JsonResult</code> of an AJAX query. My Vue receives the data just fine when I encode it from my View Model, but not when I try to retrieve it using AJAX. Here's what my code looks like:</p>
  
  <pre><code>&lt;script type="text/javascript"&gt;
  
          var allItems;// = @Html.Raw(Json.Encode(Model));
  
          $.ajax({
              url: '@Url.Action("GetItems", "Settings")',
              method: 'GET',
              success: function (data) {
                  allItems = data;
                  //alert(JSON.stringify(data));
              },
              error: function (error) {
                  alert(JSON.stringify(error));
              }
          });
  
          var ItemsVue = new Vue({
              el: '#Itemlist',
              data: {
                  Items: allItems
              },
              methods: {
  
              },
              ready: function () {
  
              }
          });
  &lt;/script&gt;
  
  &lt;div id="Itemlist"&gt;
      &lt;table class="table"&gt;
          &lt;tr&gt;
              &lt;th&gt;Item&lt;/th&gt;
              &lt;th&gt;Year&lt;/th&gt;
              &lt;th&gt;&lt;/th&gt;
          &lt;/tr&gt;
          &lt;tr v-repeat="Item: Items"&gt;
              &lt;td&gt;{{Item.DisplayName}}&lt;/td&gt;
              &lt;td&gt;{{Item.Year}}&lt;/td&gt;
              &lt;td&gt;&lt;/td&gt;
          &lt;/tr&gt;
      &lt;/table&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>This is with all of the proper includes. I know that <code>@Url.Action("GetItems", "Settings")</code> returns the correct URL and the data comes back as expected (as tested by an alert in the success function (see comment in success function in AJAX). Populating it like so: <code>var allItems = @Html.Raw(Json.Encode(Model));</code> works, but the AJAX query does not. Am I doing something wrong?</p>