i have follwoing code in jquery
function CallService3() {
$.ajax({
type: "POST",
url: "MyService.asmx/Comments",
// data: "{ 'loginid': " +"'"+ $("#txt_login").val()+"'" + ", 'pass': " + "'" + $("#txt_pass").val()+"'" + "}",
data: "{}",
contentType: "application/json; charset=utf-8",
dataType: "json",
success: OnSuccess3,
error: OnError1
}); }
function OnSuccess3(data, status) {
if(data.d.length > 5)
{
// var x =
$("#LinkButton1").show();
}
// $("#tbl").append("<tr bgcolor= #FFFF00><th>ID</th><th>NAME</th><th>age</th></tr>");
// for (var i = 0; i < data.d.length; i++) {
for (var i = 0; i <= 4; i++) {
//id of Gridview (*Note name of the columns are CaseSensitive)
$("#tbl").append("<tr><td>" + i + "</td><td>" + (data.d[i]) + "</td></tr>");
}
// $("#Label1").html(data.d);
// $("#tbl").append("<tr bgcolor= #FFFF00><th>ID</th><th>NAME</th><th>age</th></tr>");
// for (var i = 0; i < data.d.length; i++) {
// //id of Gridview (*Note name of the columns are CaseSensitive)
// $("#tbl").append("<tr><td>" + (data.d[i].id) + "</td><td>" + (data.d[i].name) + "</td><td>" + (data.d[i].age) + "</td></tr>");
// }
// $("#tbl").fadeOut();
}
function OnError1(request, status, error) {
$("#Label1").html(request.statusText);
}
and have following too
public string[] Comments()
{
List<Details> details = new List<Details>();
string[] str = new string[6];
str[0] = "Comment00";
str[1] = "Comment1";
str[2] = "Comment2";
str[3] = "Comment3";
str[4] = "Comment4";
str[5] = "Comment5";
return str;
//if (loginid == "Admin")
//{
// return "Exist";
//}
//return "Not exist";
//DataTable dtt = new DataTable("Table");
//dtt.Columns.Add(new DataColumn("id", Type.GetType("System.Int32")));
//dtt.Columns.Add(new DataColumn("name", Type.GetType("System.String")));
//dtt.Columns.Add(new DataColumn("age", Type.GetType("System.Int32")));
//dtt.Rows.Add(1, "A", 12);
//dtt.Rows.Add(2, "B", 11);
//dtt.Rows.Add(3, "C", 10);
//dtt.Rows.Add(4, "D", 09);
//created a list<> with class Details
//List<Details> detail = new List<Details>();
//foreach (DataRow dt_row in dtt.Rows)
//{
// Details usr = new Details();
// usr.id = Convert.ToInt32(dt_row["id"]);
// usr.name = dt_row["name"].ToString();
// usr.age = Convert.ToInt32(dt_row["age"]);
// detail.Add(usr);
//}
// return detail.ToArray(); // returning records of array
}
it bind html table with data return by web method ..now i need to show two things in it at the same time ..for loop counter i.e i (0,1,2,...) and <a href >data</a> for each row ..is there any way to do so