I have been learning PHP and codeigniter for a year or so now.
However, I am intrigued at what a JS framework can do. I would prefer not to start over in Ruby, though.
I have looked around, but simply can't find enough information on how ember.js or a similar framework works with the backend.
So, assuming I have created a template:
<script type="text/x-handlebars" id="posts">
<div class='posts'>
{{#each model}}
<h3>{{title}}</h3>
<p> {{desc}} </p>
{{/each}}
</div>
</script>
and a model
App.Post = DS.Model.extend({
id: DS.attr('string'),
title: DS.attr('string'),
desc: DS.attr('string')
});
How do I get JSON information from a URL? Assuming: http://mypage/ajax/getpostjson/postdata'
will return a JSON string with id/title/desc?
The ember.js docs have something like the following:
DS.RESTAdapter.reopen({
url: 'http://mypage/ajax/getpostjson/postdata'
});
Although I am not sure how you are supposed to call this data or where its stored, or specifically, how youre supposed to use it or set up your app.
In other tutorials, I found this:
App.PostsRoute = Ember.Route.extend({
model: function() {
return App.Post.find();
}
});
Which I assume connects to App.Post.
though I still am very confused.
I am just hoping to get pointed in the right direction through simple examples.