62,041
社区成员
发帖
与我相关
我的任务
分享
<script type="text/javascript">
$(document).ready(function() {
$("#btnSubmit").click(function() {
var progressbar = $("#progressbar");
var progressLabel = $(".progress-label");
progressbar.progressbar({
value: false,
change: function() {
progressLabel.text(progressbar.progressbar("value") + "%");
},
complete: function() {
progressLabel.text("完成!");
}
});
var sh = setInterval(progress, 1000);
function progress() {
var num = 0;
var val = 0;
$.ajax({
//要用post方式
type: "POST",
anync: false,
//方法所在页面和方法名
url: "tndata.aspx/GetNum",
contentType: "application/json; charset=utf-8",
dataType: "json",
success: function(data) {
//返回的数据用data.d获取内容
num = data.d;
val = parseFloat(num);
$("#result").html($("#result").html() + val + ",")
progressbar.progressbar("value", val);
if (val >= 100) {
clearInterval(sh);
}
},
error: function(err) {
//alert(err);
}
});
}
getdata();
function getdata() {
$.ajax({
//要用post方式
type: "POST",
//方法所在页面和方法名
url: "tndata.aspx/GetData",
contentType: "application/json; charset=utf-8",
dataType: "json",
success: function(data) {
//返回的数据用data.d获取内容
num = data.d;
val = parseFloat(num);
progressbar.progressbar("value", val);
if (val >= 100) {
clearInterval(sh);
}
},
error: function(err) {
//alert(err);
}
});
}
});
});
</script>