<div class="tableimage1">
<ul class="listdetail">
</ul>
</div>
using System.Web.Services;
[WebMethod]
public static string postJson()
{
//DateTime dt1 = Convert.ToDateTime("2010-10-1 10:01:30");
//DateTime dt2 = Convert.ToDateTime("2010-10-2 10:02:40");
//TimeSpan ts = dt2.Subtract(dt1);
//double a = ts.TotalSeconds;
//spansecond = a;
string json = "[{\"time\":\"4000\"},{\"time\":\"3000\"},{\"time\":\"8000\"},{\"time\":\"4800\"},{\"time\":\"5600\"},{\"time\":\"7000\"},{\"time\":\"2000\"}]";
return json;
}
$.ajax({
async: false,type:"post",
url: "/MainPage.aspx/postJson",
contentType: "application/json;charset=utf-8",
dataType: "json",
success: function (result) {
var json = eval('(' + result.d + ')')
var _li="";
$.each(json,function(i,item)
{
_li+='<li ><span>'+item.time+'</span></li>'
})
$(".listdetail").append(_li)
var n = $(".listdetail li").height()
alert(n)
$('.tableimage1').css('height', n+'px')
setInterval('sroclv(".listdetail")', 5000)
},
error: function (ex) {
alert('error')
}
})