2012-07-09 80 views
0

我有一張桌子,最後一個標籤「td」接到一個模態窗口的調用。問題是,只有當第一個模式窗口隱藏頁面重新加載,但其他模式窗口重新加載不起作用。Twitter Bootstrap:當隱藏模式時,重新加載頁面不起作用

<a class="icon-remove-sign" id="exclusao" href="#modalExclude{{janela.campanha.id}}" data-toggle="modal" title="Excluir"></a> 
// this generate the following urls: 
// http://localhost:8000/display/detail/15/#modalExclude11 
// http://localhost:8000/display/detail/15/#modalExclude12 
// http://localhost:8000/display/detail/15/#modalExclude13 

jQuery代碼:

$(function() { 
    $('#exclusao').click(function() { 
     var modal = $(this).attr('href'); 
     console.log(modal); // show the href only for the first row --> #modalExclude11 
     // show modal 
     $(modal).modal({ 
      show: false, 
     }); 
     // clean message info in modal 
     $('div#messageExclude').html(''); 
     // reload page when modal is hidden 
     $(modal).on('hidden', function() { 
      window.location.reload(true) // work only for the first row --> #modalExclude11 
     }); 

    }); 
}); 

所有情態動詞的正確顯示,但只能使頁面重載表中的第一行。有誰知道可以做什麼? 謝謝!

+3

呃,爲什麼你用'$'加前綴變量,特別是那些不包含jQuery對象的變量? – ThiefMaster 2012-07-09 16:44:16

+1

你能發佈產生你的url的js代碼嗎?我懷疑,因爲它只適用於第一個,這個電話會再次產生網址,而不會接收當前的網址... – Drewness 2012-07-09 17:11:41

+0

我從代碼中刪除「$」。 圖像顯示兩行,只爲第一行工作:http://i.imgur.com/z7bJI.png – LinuxMan 2012-07-09 17:11:51

回答

0

的問題是在ID:

<a class="icon-remove-sign" id="exclusao" href="#modalExclude{{janela.campanha.id}}" data-toggle="modal" title="Excluir"></a> 

需要用一流的工作,我forgeted的ID必須是獨一無二的代碼,但類的工作。

class="icon-remove-sign" 

謝謝!

相關問題