i am trying to generate html for the json returned array of users.. I want to do it the following way but I don't feel this is very effecient way to do this job. please review the following code and tell me whether i sould use some templated code or is there any standard for this scenario?
success: function(e){
console.log(e);
console.log(e.d[0].UserName);
var position2= $("#searchtextbox").position();
$('<div/>',
{
id:'generatedsearchdiv',
css:{
position:'absolute',
left:position2.left,
top:position2.top+20
}
}).appendTo('#searchArea');
for (var i=0; i<=e.d.length; i++)
{
$('<div/>',
{
html:"<span>"+e.d[i].UserName+"<span>"
}).appendTo('#generatedsearchdiv');
}
}