title: Connecting to php mysql database using Ember.js
body: <p>I have been learning PHP and codeigniter for a year or so now.  </p>
  
  <p>However, I am intrigued at what a JS framework can do.  I would prefer not to start over in Ruby, though.</p>
  
  <p>I have looked around, but simply can't find enough information on how ember.js or a similar framework works with the backend. </p>
  
  <p>So, assuming I have created a template:</p>
  
  <pre><code>&lt;script type="text/x-handlebars" id="posts"&gt;
  &lt;div class='posts'&gt;
  {{#each model}}
      &lt;h3&gt;{{title}}&lt;/h3&gt;
      &lt;p&gt; {{desc}} &lt;/p&gt;
  {{/each}}
  &lt;/div&gt;
  &lt;/script&gt;
  </code></pre>
  
  <p>and a model</p>
  
  <pre><code>App.Post = DS.Model.extend({
     id: DS.attr('string'),
     title: DS.attr('string'),
     desc: DS.attr('string')
  });
  </code></pre>
  
  <p>How do I get JSON information from a URL?  Assuming: <code>http://mypage/ajax/getpostjson/postdata'</code> will return a JSON string with id/title/desc?</p>
  
  <p>The ember.js docs have something like the following: </p>
  
  <pre><code>DS.RESTAdapter.reopen({
    url: 'http://mypage/ajax/getpostjson/postdata'
  });
  </code></pre>
  
  <p>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.</p>
  
  <p>In other tutorials, I found this:</p>
  
  <pre><code>App.PostsRoute = Ember.Route.extend({
     model: function() {
         return App.Post.find();
     } 
  });
  </code></pre>
  
  <p>Which I assume connects to <code>App.Post.</code> though I still am very confused. </p>
  
  <p>I am just hoping to get pointed in the right direction through simple examples.</p>