我ajax
看起來像jQuery的:點擊關閉
// send the data to the server using .ajax() or .post()
$.ajax({
type: 'POST',
url: 'addVideo',
data: {
video_title: title,
playlist_name: playlist,
url: id
// csrfmiddlewaretoken: '{{ csrf_token }}',
},
done: notify('success', 'video saved successfully'),
fail: notify('error', 'There were some errors while saving the video. Please try in a while')
});
notify
看起來像
function notify(notify_type, msg) {
var alerts = $('#alerts');
alerts.addClass('alert');
alerts.append('<a class="close" data-dismiss="alert" href="#">×</a>');
if (notify_type == 'success') {
alerts.addClass('alerts-success').append(msg).fadeIn('fast');
}
if (notify_type == 'failure') {
alerts.addClass('alerts-error').append(msg).fadeIn('fast');
}
}
- 當警報刪除div標籤當我保存按鈕點擊我獲得成功的消息爲
視頻成功保存X(十字標誌)
- 我點擊交叉,現在通知了
當我再次保存點擊按鈕,沒有任何反應,我看到螢火蟲抱怨
No elements were found with the selector: "#alerts"
我的猜測是點擊十字標記完全從DOM中刪除
div="alerts"
標記。這是對的嗎?
問題 - 我怎樣才能得到正確的行爲。點擊在十字標記刪除通知格,點擊按鈕來創建創建通知格再次
哪裏是你當你點擊你的警報的緊密聯繫代碼插件解決這一問題? – MrOBrian 2012-08-06 21:47:12
我什麼也沒做,我依賴'alerts.append('×');' – fullstackcrash 2012-08-06 21:51:20
可能你會停止在每個問題中告訴twitter bootstarap?它現在看起來像廣告。並讓ppl忽略問題,即使它簡單js問題 – 2012-08-06 21:57:13