我在XSL模板中有一个上传脚本,可以让JavaScript上传文件。它在XSL模板中。上传文件夹文件(upload.php)将在上传文件时返回JSON对象。
<script id="template-download" type="text/x-jquery-tmpl">
<a href="${url}">${url}</a>
</script>
但是当我看到输出时,只解析了第二个${url}
。
可以说,JSON绑定${the_binding}
(从JSON对象中提取)将不会被解析,而它是属性的值。
因此,结果如下:
<a href="${url}">http://google.com/search?q=this+JSON+binding+is+parsed</a>
如何让href
属性中的绑定得到它的建议值?
答案 0 :(得分:0)
Here is an example of that template being rendered correctly:
$('#template-download').tmpl({url: 'http://google.com'}).appendTo('body');
如果这对您不起作用,那么渲染模板的方式一定有问题。