Php file to give json data from mysql


#1

I need to use Ember data to retrieve a json data from php file. All the examples explain how to use json data from a external server , but for me, the application emberjs and my file php json are in same server . simple file php to generate json from mysql . you have an idea? Thanks!


#2

You are still getting data from an external server, it just happens to be on the same host. Remember that your Ember application is running in the consumers browser, not your server. So from the standpoint of Ember Data you are in the exact same boat as the guides assume.

Essentially, you need to have a PHP endpoint that responds RESTFully with the proper payloads.


#3

ok, you are right. i try my project in localhost, and i am stropping in this code :

App.Store = DS.Store.extend({
       adapter: DS.RESTAdapter.create({
            url:"http://127.0.0.1/db/articles.php"
      })
});

the articles.php is the json genertor with a header of course . what do you think ?