I modified the bloggr-client sample app to read from a rest interface at localhost:8080/api
App.Store = DS.Store.extend({
revision: 12,
adapter: DS.RESTAdapter.extend({
url: 'localhost:8080/api';}) });
I'm also using
<script src="js/libs/jquery-1.9.1.js"></script>
<script src="js/libs/handlebars-1.0.0.js"></script>
<script src="js/libs/ember-1.0.0-rc.7.js"></script>
<script src="js/libs/ember-data-master.js"></script>
In firefox, I get the following javascript error:
line 113 in ember-1.0.0.rc.7.js // When using new Error, we can't do the arguments check for Chrome. Alternatives are welcome try { fail.fail(); } catch (e) { error = e; }
In Chrome,
There adapter returns no data but I get an options error on line 8526 in jQuery
here is the results of the query. Perhaps the backslashes or quotes are killing the adapter. Can I fix this with the serializer?
query: localhost:8080/api/posts
"[{\"user\": \"joe\", \"update_time\": \"2013-08-25 23:15:03.011767\", \"create_time\": \"2013-08-25 23:05:45.405645\", \"slug\": \"apple\", \"title\": \"apple\"}, {\"user\": \"bill\", \"update_time\": \"2013-08-26 00:38:36.713749\", \"create_time\": \"2013-08-26 00:37:04.935824\", \"slug\": \"orange-id\", \"title\": \"orange\"}]"
Late breaking news, This fixed the error message. I'm now getting data back from the server with backslashes but ember data is ignoring it. Can the serializer fix this?
App.Store = DS.Store.extend({
revision: 12,
adapter: DS.RESTAdapter.extend({
bulkCommit: false,
url: "http://localhost:8080/api/medbook",
primary_key: "user",
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);
},
})
});