Templates is not binding

Sep 19 2013 6:35 AM
I am binding the json data with jquery templates likes this--

<asp:Content runat="server" ID="FeaturedContent" ContentPlaceHolderID="FeaturedContent">
     <script src="/scripts/jquery.loadTemplate-1.2.2.js"></script>
    <script type="text/javascript">
        $(document).ready(function () {
            PopulatePersons();
        });

        //Creating the ajax call, and if succeeded then display the result on UI
        function PopulatePersons() {
            $.ajax({
                type: "GET",
                url: "/Default.aspx/getEmp",
                contentType: "application/json; charset=utf-8",
                //data: "{}",
                //dataType: "json",
                success: AjaxSucceeded,
                error: AjaxFailed
            });

        }
        function AjaxSucceeded(result) {
            alert("sucess");
            $("#template").tmpl(result.d).appendTo("#placeholder");
        }
        function AjaxFailed(result) {
            alert('no success');
        }
    </script>


</asp:Content>

<asp:Content runat="server" ID="BodyContent" ContentPlaceHolderID="MainContent">
   <script type="text/html" id="template">
        <div data-content="firstname"></div>
        <div data-content="middlename"></div>
        <div data-content="lastname"></div>
        <div data-content="post"></div>
    </script>
    <ul id="placeholder"></ul>
</asp:Content>



But problem is data is not displaying?

Giving error tmpl is not found?


kindly help

Answers (1)