samedi 9 mai 2015

Access-Control-Allow-Origin error when using ember.js(with ember-cli)

Here is my routes in (app/routes/customers.js):

export default Ember.Route.extend({
  model: function() {
    return $.getJSON("http://ift.tt/1dUJBbz");
  }
});

here is my router.js:

export default Router.map(function() {
  this.route('customers', {path: '/'});
});

http://ift.tt/1dUJBbz is my api, but ember-cli use http://localhost:4200/, when I open http://localhost:4200/

in the console, the error message is: XMLHttpRequest cannot load http://ift.tt/1dUJBbz. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:4200' is therefore not allowed access.

I find a article: http://ift.tt/1sCf3eI

so I know what's wrong, but I don't kown how to fix it when use ember.js.

sorry for my poor English, hope thats clear...




Aucun commentaire:

Enregistrer un commentaire