Mauliardiwinoto
Mauliardiwinoto

Reputation: 107

ReCall iframe after setInterval

I wish popup box (iframe colorbox) keep available even after setInterval running. But in fact, only the first iframe actually can pop up, the next after 2 seconds, bring me to my requested page. (sorry for bad english)

        <script type="text/javascript">
          $(document).ready(function(){

            $("#iframe").colorbox({iframe:true, width:"400px", height:"600px"});

            var refreshId = setInterval(function() {
             $('#chatting').load("<?php echo current_url() ?> #chatting") ;
             $("#iframe").colorbox({iframe:true, width:"400px", height:"600px"});
            }, 2000);


          });
        </script>

           <div id="chatting">
                <li class="chat-list">
                    <div class="chat-body">
                        <a id="iframe"href="intern/public_chat/test.php">XXX</a>
                    </div>
                </li>
            </div>

I need every reload time (2 seconds as setinterval), updated value keep can using iframe colorbox.

But only it's always bring me to my requested page but not in pop up box.

Upvotes: 0

Views: 135

Answers (2)

Mauliardiwinoto
Mauliardiwinoto

Reputation: 107

 <script type="text/javascript">
  $(document).ready(function(){

    $("#iframe").colorbox({iframe:true, width:"500px", height:"600px"});

    var refreshId = setInterval(function() {
     $('#chatting').load("<?php echo current_url() ?> #chatting", function() {
         $("#iframe").colorbox({iframe:true, width:"500px", height:"600px"});
     }) ;
    }, 2000);


  });
</script>

Upvotes: 0

Jignesh Sanghani
Jignesh Sanghani

Reputation: 700

look at your anchor tag <a id="iframe" href="intern/public_chat/test.php</a>

i just improve and it's work <a id="iframe" href="intern/public_chat/test.php"> </a>

Upvotes: 1

Related Questions