jTemplate + Uncaught TypeError: Cannot read property 'length' of undefined
Hello,
I started using Jquery Plugins on my projects recently. I am trying to make the jTemplate work on my page but I am getting a crazy error on the page. The following is the information related to the error. Can somebody help me with this?? I am getting this error on a .NET WebForm.
Error:
Uncaught TypeError: Cannot read property 'length' of undefined
JS code setting the template:
$('#tasks').setTemplateURL('Template.htm');
$('#tasks').processTemplate(response);
Note: tasks is just a div element on the page.
Template.htm
<table>
<thead>
<tr>
<th>Date</th>
<th>Title</th>
<th>Excerpt</th>
</tr>
</thead>
<tbody>
{#foreach $T.d as post}
<tr>
<td>{$T.post.Date}</td>
<td><a href="{$T.post.Link}">{$T.post.Title}</a></td>
<td>{$T.post.Description}</td>
</tr>
{#/for}
</tbody>
</table>
Response (JSON Data):
[{"Date":"6/5/2008", "Title":"3 mistakes to avoid when using jQuery with ASP.NET AJAX", "Link":"http://encosia.com/2008/06/05/3-mistakes-to-avoid-when-using-jquery-with-aspnet-ajax/", "Description":"Three common problems that I've seen when using jQuery with ASP.NET AJAX, their underlying causes, and simple solutions to them."}, {"Date":"5/29/2008", "Title":"Using jQuery to directly call ASP.NET AJAX page methods", "Link":"http://encosia.com/2008/05/29/using-jquery-to-directly-call-aspnet-ajax-page-methods/", "Description":"An example of how to use jQuery to call an ASP.NET AJAX page method, without using a ScriptManager."}]
.NET Framework being used: 3.5
Thank You
Sundeep Nadendla