第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號(hào)安全,請(qǐng)及時(shí)綁定郵箱和手機(jī)立即綁定
已解決430363個(gè)問(wèn)題,去搜搜看,總會(huì)有你想問(wèn)的

asp.net 用ajax到后臺(tái)取值賦給html控件,可是取到的值一直沒(méi)變?

asp.net 用ajax到后臺(tái)取值賦給html控件,可是取到的值一直沒(méi)變?

陪伴而非守候 2018-12-06 23:10:57
頁(yè)面js代碼: <script src="js/jquery-1.7.1.js" type="text/javascript"></script> <script type="text/javascript"> var timer; function progressShow() { //$("#progressSpan").text("<%=progressInt %>%"); $.ajax({ //url: "自寫(xiě)progressBar.aspx/returnProgress", //type: "text/plain", //contentType: "application/text;charset=utf-8", url: "ashx/returnProgress.ashx", success: function(data){ alert(data); $("#progressDiv").width(data); $("#progressSpan").text(data); }, error: function(error){ alert("error: "+error); } }); } window.onload = function(){ timer = setInterval(progressShow,1500);} </script> ? body: <div id="contentDiv" style="width:100px; background-color:Gray;"> <div id="progressDiv" style="width:1px; background-color:Red;"> <span id="progressSpan" style="color:Black;"></span> </div> </div> ? aspx.cs: namespace progressBar進(jìn)度條 { public partial class 自寫(xiě)progressBar : System.Web.UI.Page { public static int progressInt; protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { Thread thread = new Thread(new ThreadStart(progressUp)); thread.Start(); } } public void progressUp() { for (int i = 1; i < 101; i++) { Thread.Sleep(2000); progressInt = i; } } [WebMethod] public static string returnProgress() { //HttpContext.Current.Response.Write(progressInt); //HttpContext.Current.Response.End(); return progressInt.ToString(); } } } ashx: [WebService(Namespace = "http://tempuri.org/")] [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)] public class returnProgress : IHttpHandler { public void ProcessRequest(HttpContext context) { context.Response.ContentType = "text/plain"; context.Response.Write(自寫(xiě)progressBar.progressInt); } public bool IsReusable { get { return false; } } } 實(shí)際上progressInt一直在增加,可是為什么取出來(lái)的progressInt全是0?
查看完整描述

4 回答

?
暮色呼如

TA貢獻(xiàn)1853條經(jīng)驗(yàn) 獲得超9個(gè)贊

url: "ashx/returnProgress.ashx"+new Date(),

試試

查看完整回答
反對(duì) 回復(fù) 2018-12-24
?
縹緲止盈

TA貢獻(xiàn)2041條經(jīng)驗(yàn) 獲得超4個(gè)贊

你確認(rèn)Page_Load方法被調(diào)用了嗎?

查看完整回答
反對(duì) 回復(fù) 2018-12-24
?
偶然的你

TA貢獻(xiàn)1841條經(jīng)驗(yàn) 獲得超3個(gè)贊

確定,我用timer定時(shí)取過(guò)?自寫(xiě)progressBar.progressInt的值,確實(shí)在自增啊

查看完整回答
反對(duì) 回復(fù) 2018-12-24
?
慕森王

TA貢獻(xiàn)1777條經(jīng)驗(yàn) 獲得超3個(gè)贊

單步調(diào)試下看看

查看完整回答
反對(duì) 回復(fù) 2018-12-24
  • 4 回答
  • 0 關(guān)注
  • 653 瀏覽
慕課專(zhuān)欄
更多

添加回答

舉報(bào)

0/150
提交
取消
微信客服

購(gòu)課補(bǔ)貼
聯(lián)系客服咨詢(xún)優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號(hào)

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號(hào)