我喜欢在渲染一个活跃的模板时提取一些远程数据。由于请求的异步性质,没有数据将其输出。我怎样才能做到这一点?
var ractive = new Ractive({
debug: true,
el: 'container',
template: '#template',
data:
{
chapters:chapters,
load_text: function(path)
{
$.get(path, function( text ) {
return text;
});
}
}
});