I'm trying to load a .htm template from .js file. But there is a script present in .htm file which gets triggers when the template is loaded and things are smooth.
Here how the template looks. testing.htm
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>http://stackoverflow.com/questions/6946559/jqgrid-please-help</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,
"sAjaxSource": '/Home/GetData',
"sScrollY": "400px",
"sScrollX": "200px",
"bPaginate": false
});
});
</script>
</head>
<div id="dynamic">
<table cellpadding="0" cellspacing="0" border="0" class="display" id="example">
<thead>
<tr>
<th width="20%">Date</th>
<th width="25%">Name</th>
<th width="25%">ProposalID</th>
<th width="25%">Time</th>
</tr>
</thead>
<tbody>
</tbody>
</table>
</div>
</html>
Here is the .js file which loads the template.
var iTabs = function () {
return {
Init: function () {
var placeholder = $("#testtab");
placeholder.setTemplateURL("/Templates/Home/testing.htm");
placeholder.load("/Templates/Home/testing.htm");
}
}
} ();
But, now i want to execute the .htm script in .js file i.e after loading the template. If i run only a part of script i.e
$('#example').dataTable({
"bProcessing": true,
"sAjaxSource": '/Home/GetData',
"sScrollY": "400px",
"sScrollX": "200px",
"bPaginate": false
});
in .js file, it wont work. Is it possible to run this script in .js file?. if so how?