当我在控制台日志中打印出来时,我可以看到该值,但是我没有看到该值被填充到 list.html 内的 html 页面中。所以我猜我需要确保元素在它之前已经加载?任何建议将不胜感激。
html:
<script type="text/html" id="searchPickPlaceTemplate">
<div class="searchPickWhere_box">
<ul data-inset="true">
<li><a data-transition="slide" id="searchPickWhere" href="list.html">{{whereSearch}}</a></li>
</ul>
</div>
</p>
脚本:
$('#restWhere').bind('touchstart mousedown', function (e) {
$.ajax({
type: "POST",
contentType: "application/json; charset=utf-8",
url: WebServiceURL + "GetSuburbsWithPlacesAndCity",
dataType: "json",
data: "{'cityId':'" + cityId + "', 'categoryId': '" + categoryId + "'}",
success: function (result) {
$("#searchPickPlace").html("");
$.each(result.d, function () {
$(document).ready(function () {
console.log('SubrubName asdfsd ' + this.name);
var test = $("#searchPickPlaceTemplate").text();
test = test.replace("{{whereSearch}}", this.name);
$("#searchPickPlace").append(searchPickRestaurnt);
});
});
}
});
});