62,271
社区成员
发帖
与我相关
我的任务
分享
function Message() {
$.post("Server.aspx", { Action: "M" },
function(data) {
$("#SystemMessage").html(data); //要显示的地方的层的Id
});
string a= this.Request.Params["Action"];
if(a=="M")
{
string str= "读取的字段";
Response.Write(str);
Response.End();
}
<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
<asp:Timer ID="Timer1" runat="server" Interval="1000" OnTick="Timer1_Tick"></asp:Timer>
<asp:Label ID="Label1" runat="server" Text="Label"></asp:Label>
</ContentTemplate>
</asp:UpdatePanel>
<script runat="server">
protected void Timer1_Tick(object sender, EventArgs e)
{
Label1.Text = M();
}
public string M()
{
string str = "数据库里取 " + DateTime.Now.ToString();
return str;
}
</script>