php - How to populate a select field in Ember js -
app = ember.application.create(); app.router.map(function() { // put routes here }); app.indexroute = ember.route.extend({ model: function() { return app.item.all(); } }); app.item = ember.object.extend(); app.item.reopenclass({ all: function() { return $.getjson("http://localhost/zohobus/gettable.php").then(function(response) { var items = []; response.items.foreach( function (item) { items.push( app.item.create(item) ); }); return items; }); } }); // part of index.html <script type="text/x-handlebars" id="index"> <ul> {{#each item in model}} <li>{{item.fromm}}</li> {{/each}} </ul> </script> i getting error when have php returns json object
php returns :
[{"fromm":"chennai"},{"fromm":"chennai"},{"fromm":"madurai"},{"fromm":"madurai"},{"fromm":"chennai"},{"fromm":"chennai"}]
in ember -chrome tool error
xmlhttprequest cannot load http://localhost/zohobus/gettable.php. no 'access-control-allow-origin' header present on requested resource. origin 'http://localhost:8080' therefore not allowed access.
you need setup cors in server. have @ these resources:
Comments
Post a Comment