I'm testing Sammy.js from client-side, Sinatra for connect to MongoHQ and retrieve documents. But, I've a problem with Sammy.js to retrieve it. My code looks like:
this.get('#/', function(context) {
this.load('http://localhost:4567/test.json', { cache: false })
.then(function(items) {
context.items = items;
})
.partial('templates/index.ms');
});
XMLHttpRequest cannot load http:// localhost:4567/test.json. Origin http:// localhost is not allowed by Access-Control-Allow-Origin.
What do you recommend to fix it?
I don't know why I asked this question and why still not been answered.
this.get('#/', function(context) {
context.load('http://...', { dataType: 'jsonp' })
.then(function(items) {
context.items = items;
})
.partial('templates/index.ms');
});
Just add the datatype to json padding.