异步调用出错
我用JS调用后台方法,下面是我的代码:
namespace Original.LabManage.WebUI.Pages
{
public partial class MasterPage : System.Web.UI.MasterPage
{
//前台JS调用后台类方法前注册
AjaxPro.Utility.RegisterTypeForAjax(typeof(MasterPage),this.Page);
}
#region 获取未读消息数量
/// <summary>
/// 获取未读消息数量
/// </summary>
[AjaxPro.AjaxMethod]
public string GetNewsStatusCount()
{
string count = BLLNews.GetDataListCount().ToString();
return count;
}
#endregion
}
function GetCount()
{
var count = Original.LabManage.WebUI.Pages.MasterPage.GetNewsStatusCount().value;
if(count == "0")
{
document.getElementById("<%=Label1.ClientID %>").style.display="none";
document.getElementById("<%=txtCount.ClientID %>").style.display="none";
document.getElementById("<%=Label2.ClientID %>").style.display="none";
}
else
{
document.getElementById("<%=txtCount.ClientID %>").innerText=count;
}
}
setInterval("GetCount()",1000);
一运行就报 Original 未定义的错误,这是什么原因呢?
------解决方案--------------------
http://www.cnblogs.com/lexus/archive/2007/11/29/977281.html
http://www.cnblogs.com/dreamof/archive/2009/01/12/1374099.html