Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/226.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/visual-studio-2012/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 将变量传递到引导模式_Javascript_Php_Jquery_Twitter Bootstrap - Fatal编程技术网

Javascript 将变量传递到引导模式

Javascript 将变量传递到引导模式,javascript,php,jquery,twitter-bootstrap,Javascript,Php,Jquery,Twitter Bootstrap,我可以将变量传递到模式底部的bootstrap 3模式,该模式显示id=“callId”,但如何将callId传递到有$test=callId的模式 <a data-id="<?=$sid?>" data-conf="<?=$call_conf?>" class="open-AddCallDialog btn btn-success btn-xs" href="#addCallDialog">Call Borrower</a> 模态 <di

我可以将变量传递到模式底部的bootstrap 3模式,该模式显示id=“callId”,但如何将callId传递到有$test=callId的模式

<a data-id="<?=$sid?>" data-conf="<?=$call_conf?>" class="open-AddCallDialog btn btn-success btn-xs" href="#addCallDialog">Call Borrower</a>
模态

<div class="modal fade" id="addCallDialog"> tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
  <div class="modal-dialog">
    <div class="modal-content">
      <div class="modal-header">
        <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
        <h4 class="modal-title" id="myModalLabel">Call Borrower</h4>
      </div>
      <div class="modal-body">
      <div class="row well">
       $test = call_conf;



      </div>
      </div>
       <div class="modal-footer">
        <input name="id" id="callId" type="hidden" value=""/> 
        <input name="pid" type="hidden" value="<?php echo $pid;?>"/>
        <input name="processtp" type="hidden" value="callborrower"/>
        <button id="submit" class="btn btn-primary btn-block btn-xs center">Update</button>
      </div>
      </form>
      </div>

    </div><!-- /.modal-content -->
  </div><!-- /.modal-dialog -->
tabindex=“-1”role=“dialog”aria labelledby=“myModalLabel”aria hidden=“true”>
&时代;
通知借款人
$test=call_conf;

创建/销毁引导模态时会触发一些事件

您需要的是
show.bs.modal
,一旦显示了modal并且所有CSS3动画都完成了,就会触发它。通过挂接到此事件,可以将数据添加到模态的DOM结构中

$(document).on('click', '.openAddCallDialog', function(event)
{
    var _self = $(this),
        id = _self.data('id'),
        conf = _self.data('conf'),
        modalEl = $(_self.attr('href'));

    modalEl.modal('show').one('shown.bs.modal', function(event)
    {            
        // This function body is the modal shown event callback
        // You can do anything in this function to modify the DOM
        // within the shown modal.

        var modal = $(this);

        modal.find('#callId').val(callId);

        modal.find('.well').text(conf);
    });;
}

我不太清楚。你能修改语法并解释你想要获得什么吗?我能用这个脚本添加两个变量吗?当然,只需获取你需要的变量,然后将它们添加到回调中的模式中。我用我想要添加的变量更改了上面的链接,并将其添加到我想要显示的模式中。对不起,我应该把这个放在我原来的问题里。我不理解您在回调中所说的上面的答案。修改答案以向您展示我所说的回调的含义,并为您添加
conf
数据。我理解DOM的内容。在那里我可以找到模态中的任何东西。但现在它不会打开在我更改代码之前打开的模式
$(document).on('click', '.openAddCallDialog', function(event)
{
    var _self = $(this),
        id = _self.data('id'),
        conf = _self.data('conf'),
        modalEl = $(_self.attr('href'));

    modalEl.modal('show').one('shown.bs.modal', function(event)
    {            
        // This function body is the modal shown event callback
        // You can do anything in this function to modify the DOM
        // within the shown modal.

        var modal = $(this);

        modal.find('#callId').val(callId);

        modal.find('.well').text(conf);
    });;
}