Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/390.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_Jquery_Html_Twitter Bootstrap - Fatal编程技术网

Javascript 引导模式框在远程选项卡中不工作

Javascript 引导模式框在远程选项卡中不工作,javascript,jquery,html,twitter-bootstrap,Javascript,Jquery,Html,Twitter Bootstrap,我使用插件,需要将$.ajax模式框链接加载到每个远程选项卡中,如下所示: HTML: 实际上,第一个选项卡工作并将远程值显示在modalbox中,但当我单击另一个选项卡时,我会看到链接,但在单击后,modalbox不会显示,也不会使用远程链接。你如何解决这个问题 注意:请单击远程选项卡的检查模式链接 Live发现了问题。在第一个选项卡中加载页面时,您正在绑定.push元素,因此第一个模式正在工作,而在第二个选项卡(远程选项卡)中,.push元素未绑定。所以 你的JS应该是这样的: $(docu

我使用插件,需要将
$.ajax
模式框链接加载到每个远程选项卡中,如下所示:

HTML:

实际上,第一个选项卡工作并将远程值显示在modalbox中,但当我单击另一个选项卡时,我会看到链接,但在单击后,modalbox不会显示,也不会使用远程链接。你如何解决这个问题

注意:请单击远程选项卡的
检查模式
链接


Live发现了问题。在第一个选项卡中加载页面时,您正在绑定
.push
元素,因此第一个模式正在工作,而在第二个选项卡(远程选项卡)中,
.push
元素未绑定。所以

你的JS应该是这样的:

$(document).on('click', '.push', function(e) {
  e.preventDefault();
  var id = $(this).attr('id');

  $.ajax({
    type: 'post',
    url: 'remote/remote.php', // in here you should put your query 
    data: {
      'bookid': id,
      'lang': 'en'
    }, // here you pass your id via ajax .
    // in php you should use $_POST['post_id'] to get this value 
    success: function(r) {
      // now you can show output in your modal 
      $('#bookdetails').modal({
          backdrop: 'static',
          keyboard: false
        }) // put your modal id 
      $('.something').show().html(r);
    }
  });
});

. 你错过了锚链上的属性(
数据切换和数据目标)。@JSantosh:你能告诉我你的意思吗?!请根据您的想法编辑我的代码。
$(document).ready(function() {

        $(function() {

            $('.push').click(function(e) {
                e.preventDefault(); 
                var id = $(this).attr('id');

                $.ajax({
                    type: 'post',
                    url: 'remote/remote.php', // in here you should put your query 
                    data: {'bookid' : id,'lang' : 'en'}, // here you pass your id via ajax .
                    // in php you should use $_POST['post_id'] to get this value 
                    success: function(r) {
                        // now you can show output in your modal 
                        $('#bookdetails').modal({
                                backdrop: 'static',
                                keyboard: false
                            }) // put your modal id 
                        $('.something').show().html(r);
                    }
                });


            });

        });
    });
$(document).on('click', '.push', function(e) {
  e.preventDefault();
  var id = $(this).attr('id');

  $.ajax({
    type: 'post',
    url: 'remote/remote.php', // in here you should put your query 
    data: {
      'bookid': id,
      'lang': 'en'
    }, // here you pass your id via ajax .
    // in php you should use $_POST['post_id'] to get this value 
    success: function(r) {
      // now you can show output in your modal 
      $('#bookdetails').modal({
          backdrop: 'static',
          keyboard: false
        }) // put your modal id 
      $('.something').show().html(r);
    }
  });
});