等待直到for循环中的模态关闭

时间:2015-10-09 14:08:21

标签: jquery twitter-bootstrap modal-dialog

我有一个for循环,在每次迭代时,我都计划打开一个模态(我使用bootstrap 2.3.2 )。但是有一个问题,我需要等到当前的模态关闭。所以这是我的代码:

for(i in connections){

var sourceId=connections[i].sourceId;
var sourceResultSet;
sourceResultSet=findResultSet(sourceId,blocks);
$('#match-body').append($('<p id="filterInfo">'+sourceResultSet+'</p>'));
$('#input-output-match').modal('show');
// now here, until the current modal is closed, the code should wait  and then it need to continue to iteration.
}

这是我的html部分:

<div id="input-output-match" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
    <div class="modal-header">
          <button type="button" class="close" data-dismiss="modal" aria-hidden="true"> × </button>
          <h3 id="myModalLabel">Source Entity Name -> Target Entity Name</h3>
    </div>
    <div class="modal-body" id='match-body'>
    </div>
    <div class="modal-footer">
    <button class="btn" data-dismiss="modal" aria-hidden="true">Finish</button>
</div>

0 个答案:

没有答案