我有两个 div,我想在那里加载模板。我正在尝试像这样加载,它不起作用。这是我的代码。
主文件.htm
Details
<div id="placeholder1" />
<div id="placeholder2" />
模板1.htm
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<script type="text/javascript" charset="utf-8">
$(document).ready(function () {
$('#example').dataTable({
"bProcessing": true,
"bPaginate": false,
"sAjaxSource": '/Home/GetReport1',
});
});
</script>
</head>
TESTING.........
<div id="dynamic">
<table cellpadding="0" cellspacing="0" border="0" class="display" id="example">
<thead>
<tr>
<th width="20%">Date</th>
<th width="25%">Time</th>
</tr>
</thead>
<tbody>
</tbody>
</table>
</div>
</html>
模板2.htm
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<script type="text/javascript" charset="utf-8">
$(document).ready(function () {
$('#example').dataTable({
"bProcessing": true,
"bPaginate": false,
"sAjaxSource": '/Home/GetReport1',
});
});
</script>
</head>
TESTING.........
<div id="dynamic">
<table cellpadding="0" cellspacing="0" border="0" class="display" id="example">
<thead>
<tr>
<th width="20%">Place</th>
<th width="25%">Food</th>
</tr>
</thead>
<tbody>
</tbody>
</table>
</div>
</html>
这里我如何加载模板表单 JS 文件
myjs.js
var placeholder = $("#tab");
placeholder.setTemplateURL("/Templates/Home/main.htm");
placeholder.load("/Templates/Home/pricinghistory.htm");
var firstDiv = $("placeholder1");
firstDiv.setTemplate("/Templates/Home/Template1.htm");
firstDiv.load("/Templates/Home/Template1.htm");