Picture of aaron quinn
getting data into a component
by aaron quinn - Sunday, 5 February 2017, 9:59 PM

hi all,

i have a php page that:

// Print it out as JSON
echo json_encode($newArray);

so i get nicely formatted json data which i can turn into a collection that i can do things with... but how can i get this data into the component? i don't know what other plugins to look at for ideas and i don't know what search terms to google. can someone point me into the right direction?


Picture of Chuck Lorenz
Re: getting data into a component
by Chuck Lorenz - Monday, 6 February 2017, 1:10 AM


The framework core has grunt commands to import and export translatable text. Perhaps this might be a path to explore? Look at the grunt tasks in this folder in the framework repo: adapt_framework/grunt/tasks/translate 

These tasks were developed to support the multi-language feature of Adapt.  Thomas Berger would be a sensible contact if you want/need insight into them. Find him in the main gitter rooms as lc-thomasberger.


Picture of aaron quinn
Re: getting data into a component
by aaron quinn - Monday, 6 February 2017, 7:30 AM

thanks chuck, but i already found my answer. it was right there in the backbone documentation the whole time, under fetch. so i tried calling a function during the component's postRender which does this:


var jsondata;
jsondata = new Backbone.Collection;
jsondata.url = 'http://someSite.com/someFolder/someData.php';
success: function(collection, response, options) {
error: function (collection, response, options) {


and the console logged all the data from the php echo without any errors! on to the next step...