Jquery template error $(…).tmpl is not a function


I want use jquery template but it doesn't work correctly.
here's my mark up Html. it's simple but i confuse why it doesn't work Correctly

 <head runat="server">
    <script src="Resource/Scripts/jquery.min.js" type="text/javascript"></script>
        <script src="Resource/Scripts/jquery-tmpl.js"></script>    
            <script id="myTmpl" type="text/x-jquery-tmpl" >
                        <td><label >${sum}</label></td>
            <script type="text/javascript">
                     jQuery(document).ready(function () {
                            var data = [{ urlPic: "abc.jpg", name: "Tom", count: "3", price: "3000000
        0", sum: "40000000" } ];

    // below line raise errro                   

and here's my html

    <form id="form1" runat="server">
        <table id="baskettbl2"><table>

I get this Error:

TypeError: $(...).tmpl is not a function

I found it doesn't work only on first request. this template is in my Master Page. When load Default. it doesn't work. but when click to another page, it works! what's the problem? i'm really confused

Best Solution

I suggest you to do 2 checks:

  • Use browser built-in network capture to see if the libraries are loaded properly.
  • Check if another library or script on the page overrides the $ variable.