Connecting Tech Pros Worldwide Help | Site Map

display php output in javascript?

Member
 
Join Date: Nov 2007
Posts: 77
#1: Mar 13 '08
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

Expand|Select|Wrap|Line Numbers
  1. <html>
  2. <head>
  3. <title>Who is chatting</title>
  4. <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
  5. </head>
  6. <body bgcolor="#e4eaf2" topmargin="0" marginheight="0">
  7. <font size='1' face="Verdana, Arial, Helvetica, sans-serif"> 
  8. <?php
  9.  
  10.  
  11.  
  12.  
  13. $chatnames = file('http://client11.addonchat.com/scwho.pl?id=292747&plain=1');
  14.  
  15.  
  16. $indx = count($chatnames);
  17. $indxcom = $indx - 1;
  18.  
  19. if ($indx == 0){
  20. 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. ";
  21. }
  22.  
  23. else{
  24. echo "<b>People Chatting:</b>&nbsp;&nbsp;";
  25.  
  26.   for($i = 0; $i < $indx; $i++) {
  27.  
  28.     $name = explode('TAB', $chatnames[$i], 2);
  29.  
  30.     echo " $name[0]";
  31.  
  32.     if ($i < $indxcom) {
  33.  
  34.    echo ", ";
  35. }  
  36.  
  37.   }
  38. }
  39.  
  40. ?>
  41. </font> 
  42. </body>
  43.  
  44. </html>
Expand|Select|Wrap|Line Numbers
  1. <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's Avatar
Moderator
 
Join Date: Jun 2007
Location: York, England, with wolves.
Posts: 4,936
#2: Mar 13 '08

re: display php output in javascript?


I dont understand.
You're trying to "output a php file in javascript"?
Explain more please :)
Member
 
Join Date: Nov 2007
Posts: 77
#3: Mar 13 '08

re: display php output in javascript?


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?
Reply