2012-07-09 50 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" 

谢谢!

相关问题