Stack Overflow is a community of 4.7 million programmers, just like you, helping each other.

Join them; it only takes a minute:

Sign up
Join the Stack Overflow community to:
  1. Ask programming questions
  2. Answer and help your peers
  3. Get recognized for your expertise

This question already has an answer here:

I'm having trouble using vue-resource with some json data. I'm following the example here: https://github.com/vuejs/vue-resource/blob/master/docs/http.md

My vue-resource call looks like this:

  ready: function() {    
    this.$http.get('http://section.dynns.com/sections').then(function (response) {
      this.$set('data_list', response.data)
  });
},

See jsfiddle here: http://jsfiddle.net/greene48/yb5chmfr/

But, switching that api call for a different set of data seems to work: http://jsfiddle.net/greene48/92gfwqL3/

So, maybe there is something wrong with the json I'm trying to use? Any help would be appreciated. Thanks

share|improve this question

marked as duplicate by ceejayoz, Community Feb 9 at 21:05

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

up vote 2 down vote accepted

http://jsonplaceholder.typicode.com/posts sets CORS headers. http://section.dynns.com/sections does not. Without CORS headers, your requests to a different domain name are subject to the browser's same-origin policy and will fail.

Your other options are JSONP (if the API supports it) or proxying requests through a server-side script.

share|improve this answer
1  
Thanks alot, this might have been an obvious answer but I'm new to all this. I added CORS headers to the data and it seems to be working now. – greenerr Feb 9 at 20:47

Not the answer you're looking for? Browse other questions tagged or ask your own question.