Continue mvc-11 (UP). dto:http://www.cnblogs.com/tangge/p/3840060.html
Jquery.tmpl.js Download: http://pan.baidu.com/s/1o68w7Ke
1. Front Desk
Index.cshtml
@{Viewbag.title ="Student List";} @section headsection{ <Scripttype= "Text/x-jquery-tmpl"ID= "Trtemp" > <TR> <th>${StudentID}</th> <th>${Cid}</th> <th>${Name}</th> <th>${Gender}</th> <th>Operation</th> </TR> </Script> <Scripttype= "Text/javascript" >$(function() { //0. Turn off jquery's browser cache$.ajaxsetup ({cache:false}); Loadpagelist (1); }); //Request data asynchronously based on page numberfunctionloadpagelist (pageIndex) {$.get ("/stu/list/"+ PageIndex,NULL, function(jsondata) {if(jsondata.statu=="OK") { //alert (jsondata.msg); $("#trtemp"). Tmpl (JsonData.Data.PageData). AppendTo ("#tableList"); } alert (JSONDATA.MSG); },"JSON"); } </Script>}<TableID= "Tablelist"Border= "1"cellspacing= "0"cellpadding= "0"width= "100%" > <TR> <th>ID</th> <th>class name</th> <th>name</th> <th>Sex</th> <th>Operation</th> </TR></Table>
But to make an error
TypeError: $ (...). Tmpl is not a function
$ ("#trtemp"). Tmpl (JsonData.Data.PageData). AppendTo ("#tableList");
Looking for a long reason, results view page source code
Here, inside the _layout.cshtml, introduce Juqey and Tmpl, then annotate
@Scripts. Render ("~/bundles/jquery")