Cheers! I have ember-data store:
TravelClient.Store = DS.Store.extend({
revision: 11,
adapter: DS.RESTAdapter.create({ bulkCommit: false, url: \"http://
The RESTAdapter expects JSON that is not the problem but the page and the json are not on the same domain, this is a security issue. You can resolve this by using one of the two solutions named below.
You're running into the same origin policy you should either use JSONP or CORS. The quickest fix would probably be to tell ember-data that you want to use JSONP.
For CORS your server needs to respond to an OPTIONS request with the headers:
Access-Control-Allow-OriginAccess-Control-Request-Methodi'm no rails expert but you will probably need to do something with the gem rack-cors see here or here.
You could do that by overriding the ajax hook in the RESTAdapter like so:
App.store = DS.Store.create({
revision: 11,
adapter: DS.RESTAdapter.create({
namespace: "data",
url: "",
ajax: function (url, type, hash) {
hash.url = url;
hash.type = type;
hash.dataType = 'jsonp';
hash.contentType = 'application/json; charset=utf-8';
hash.context = this;
if (hash.data && type !== 'GET') {
hash.data = JSON.stringify(hash.data);
}
jQuery.ajax(hash);
},
})
});