<script src="../js/jtemplates.js"></script> <script type="text/javascript"> $(document).ready(function () { $.ajax({ type: "POST", url: "frmUser.aspx/GetUserList", data: "{}", contentType: "application/json; charset=utf-8", dataType: "json", success: function (data) { $('#userContainer').setTemplateURL('../JTemplate/User.htm'); $('#userContainer').processTemplate(data.d); }, error: function () { alert("Error"); } }); }); </script> <div id="userContainer"> </div>
Here My Cs Page Code using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using System.Web.Services; using Bl; namespace HotelManagementSystem.Masters { public partial class frmUser : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { // GetUserList(); } [WebMethod] public static List <UserDetails> GetUserList() { return Bl.Users.GetUserList(); } } } here my jtemplate <div> <h3>User List</h3> {#foreach $T as user} <div>{$T.user.FirstName}</div> {#/for} </div>
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)