使用句柄显示来自parse.com的json响应 [英] Display json response from parse.com using handlebars
本文介绍了使用句柄显示来自parse.com的json响应的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想将一个json响应传递给handlebars。我已经看过解析文档和stackoverflow问题,但我似乎无法弄清楚这一点。
I would like to pass a json response to handlebars. I have looked at the parse documentation and stackoverflow questions but I cannot seem to figure this out.
这是回应:
This is the response:
{"results":[{"address":"755 W. Yale","createdAt":"2013-02-09T01:12:15.732Z","updatedAt":"2013-02-09T01:12:15.732Z","objectId":"JomKPfme5M"}]}
这是我的把手模板:
<script id="post-template" type="text/x-handlebars-template">
<h1>{{address}}</h1>
</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);
}
});
谢谢
Thank you
推荐答案
如果您使用EmberJS Ember-Model-Parse-Adapter 很好
If you are using EmberJS Ember-Model-Parse-Adapter is good
这篇关于使用句柄显示来自parse.com的json响应的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文