display php output in javascript?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Inny
    New Member
    • Nov 2007
    • 77

    display php output in javascript?

    Im trying to display output from a php file in javascript by using an iframe,
    its displaying the raw code instead. I just want the output text, how can I do it please?

    the code

    Code:
    <html>
    <head>
    <title>Who is chatting</title>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    </head>
    <body bgcolor="#e4eaf2" topmargin="0" marginheight="0">
    <font size='1' face="Verdana, Arial, Helvetica, sans-serif"> 
    <?php
    
    
    
    
    $chatnames = file('http://client11.addonchat.com/scwho.pl?id=292747&plain=1');
    
    
    $indx = count($chatnames);
    $indxcom = $indx - 1;
    
    if ($indx == 0){
    echo "No one is in the chat room at the moment. <br /> Why not log in and see if you entice others to join you. ";
    }
    
    else{
    echo "<b>People Chatting:</b>&nbsp;&nbsp;";
    
      for($i = 0; $i < $indx; $i++) {
    
        $name = explode('TAB', $chatnames[$i], 2);
    
        echo " $name[0]";
       
        if ($i < $indxcom) {
       
       echo ", ";
    }  
    
      }
    }
    
    ?>
    </font> 
    </body>
    
    </html>
    Code:
    <IFRAME SRC="http://inny.ipbfree.com/index.php?act=Attach&type=post&id=1353" WIDTH=50% marginwidth="0" height=35 marginheight="10" align="middle" scrolling="no" frameborder=0 ></IFRAME>
  • Markus
    Recognized Expert Expert
    • Jun 2007
    • 6092

    #2
    I dont understand.
    You're trying to "output a php file in javascript"?
    Explain more please :)

    Comment

    • Inny
      New Member
      • Nov 2007
      • 77

      #3
      The php file above is to show users chatting in my chatroom., Im using an iframe to display its output

      aka 'people chatting: x' where x is the names of people chating.

      or 'No people chatting' if there are none.

      I cannot use php code directly on my board therefore Im hosting it as a file

      and displaying in javascript in an iframe.....or trying to.

      Maybe theres a way to use javascript or ajax to do this instead?

      Comment

      Working...