views:

24

answers:

0

Hi, I was trying to use the jquery templates (http://stanlemon.net/projects/jquery-templates.html).

What I am trying to do

I am trying to fetch an array of objects through JSON and render them using the jquery templates. I get the JSON as follows

[{"type":"todo","title":"sample task","description":"this is description","tags":["todo","delete"],"objectId":"2"},{"type":"todo","title":"Do it right now","description":"you have to do everything","tags":["todo","delete"],"objectId":"3"}]

And to render it using the jquery template plugin, I do the following

for(var i=0; i<data.length; i++)
{
  var task = data[i];
  //alert('hello');
  $('#tasks').append($.template(taskTemplate), task);
}

What happens

This works fine in firefox and chrome but not in IE (I have v8). The for loop is executed but nothing is rendered in the #tasks div. The weird thing I noticed is that if I uncomment the alert in for loop, things are rendered properly after every pop up.

What could be the problem? please help! Thanks in advance :)