reload an iframe from other file

Discussion in 'JavaScript' started by hip_hop_x, Mar 2, 2008.

  1. #1
    hello,
    Is there any way of reloading from a page only the iframe?
    Main page is chat.php, there's an iframe( chat_box.php ) wich i want to refresh without refreshing chat.php
    i wrote
    
    function rel(){
    	window.location="chat_box.php";
    	window.location.reload();	
    }
    
    PHP:
    But seems that all the page refreshes :confused:...
    Thanks in advance
     
    hip_hop_x, Mar 2, 2008 IP
  2. Cybernaut

    Cybernaut Peon

    Messages:
    408
    Likes Received:
    12
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Reload from inside chat_box.php using document.location.reload();
     
    Cybernaut, Mar 2, 2008 IP
  3. hip_hop_x

    hip_hop_x Active Member

    Messages:
    522
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    90
    #3
    thank you, also is there any way of doing sort of live refresh? To refresh each second a part of code, without loading all the page?
     
    hip_hop_x, Mar 2, 2008 IP
  4. Cybernaut

    Cybernaut Peon

    Messages:
    408
    Likes Received:
    12
    Best Answers:
    0
    Trophy Points:
    0
    #4
    Yes, using AJAX. Search google about XMLHttpRequest. You can get new data from server using ajax and insert it in page or replace with old html code using javascript (innerHTML, appendChild etc).
     
    Cybernaut, Mar 3, 2008 IP
  5. hip_hop_x

    hip_hop_x Active Member

    Messages:
    522
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    90
    #5
    hmm, i coded the actual chat in ajax, dm-strike.com/chat.php, but how to keep updating the chat page? I am using currently the meta refresh, in the chat_box.php
     
    hip_hop_x, Mar 3, 2008 IP