嗨,我想通知彈出如果需要出現。我正在使用一個asp.net計時器來檢查是否有新消息到達。我得到的問題是,jquery通知不顯示。我猜這是與更新面板有關的事情。因爲當我試圖從頁面加載調用它時,它工作正常。這是我的代碼;jquery通知彈出窗口 - jquery和updatepanels
protected void updateTimer_OnTick(object sender, EventArgs e)
{
Cache Cache = new Cache();
users = Cache.getUserDetailsByUserID(Convert.ToInt32(Page.User.Identity.Name));
if (users._bNewNotification)
{
List<UserNotification> listUserNotification = null;
listUserNotification = Cache.getLatestNotifcationsByUserID(Convert.ToInt32(Page.User.Identity.Name));
foreach (UserNotification userNotification in listUserNotification)
{
StringBuilder jquery2 = new StringBuilder();
jquery2.AppendLine("$.extend($.gritter.options, {");
jquery2.AppendLine("position: 'bottom-left',");
jquery2.AppendLine("fade_in_speed: 100,");
jquery2.AppendLine("fade_out_speed: 100,");
jquery2.AppendLine("time: 3000");
jquery2.AppendLine("});");
Page.ClientScript.RegisterStartupScript(typeof(Page), Guid.NewGuid().ToString(), jquery2.ToString(), true);
StringBuilder jquery1 = new StringBuilder();
jquery1.AppendLine(" var unique_id = $.gritter.add({");
jquery1.AppendLine(" title: 'This is a sticky notice!',");
jquery1.AppendLine(" text: '" + userNotification._NotificationType + "',");
jquery1.AppendLine(" image: 'http://s3.amazonaws.com/twitter_production/profile_images/132499022/myface_bigger.jpg',");
jquery1.AppendLine(" sticky: true,");
jquery1.AppendLine(" time: '',");
jquery1.AppendLine(" class_name: 'my-sticky-class'");
jquery1.AppendLine(" });");
Page.ClientScript.RegisterStartupScript(typeof(Page), Guid.NewGuid().ToString(), jquery1.ToString(), true);
}
users._bNewNotification = false;
users.UpdateNewNotification();
Cache.RemoveUserProfileCacheByUserID(users._USERS_ID);
}
}
有人可以幫助我弄清楚它是什麼,我做錯了,感謝
你看過一個Javascript調試器/瀏覽器控制檯來檢查運行時錯誤嗎? – foxy 2011-06-16 11:35:44
是的,沒有錯誤被拋出。我需要重新加載我的JavaScript文件,因爲我知道該函數依賴於正在加載的文件? – pmillio 2011-06-16 11:49:51