var htmlTemplate = $("#ServiceAndAdDetails").render(result);
$("#DirectorySection").empty();
$("#DirectorySection").html( htmlTemplate );
我在按钮点击事件(ajax post success event)中使用了上述编码。
此处#ServiceAndAdDetails
是在视图页面中设计的模板。
#DirectorySection
是div。
对我来说,模板渲染两次。 提前谢谢。