Display json response from parse.com using rudders

I would like to pass the json response to the steering wheel. I looked at syntax analysis questions and stack questions, but I can't figure it out.

This is the answer:

{"results":[{"address":"755 W. Yale","createdAt":"2013-02-09T01:12:15.732Z","updatedAt":"2013-02-09T01:12:15.732Z","objectId":"JomKPfme5M"}]} 

This is my handlebars template:

 <script id="post-template" type="text/x-handlebars-template"> <h1>{{address}}</h1> </script> 

This is a script

 Parse.initialize("xxxxxx", "yyyyyy"); var listingsView = Parse.Object.extend("listings"); var query = new Parse.Query(listingsView); query.equalTo("objectId", "JomKPfme5M"); query.first({ success: function(results){ var source = $('#post-template').html(); var template = Handlebars.compile(source); var html = template(results); }, error: function(object, error){ console.log(error); } }); 

thanks

+4
source share
3 answers

Results are an array. Try passing the first element to the template.

  var html = template(results[0]); 
0
source

And if Hecter's answer does not work, try the following:

 var html = template(results[0].attributes); 
0
source

If you use EmberJS Ember-Model-Parse-Adapter well

0
source

All Articles