Wrox Programmer Forums
|
Pro PHP Advanced PHP coding discussions. Beginning-level questions will be redirected to the Beginning PHP forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Pro PHP section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old January 26th, 2006, 08:59 PM
Friend of Wrox
 
Join Date: Dec 2004
Posts: 154
Thanks: 0
Thanked 0 Times in 0 Posts
Default Ajax >.<

Problem:
Imagine 2 Frames (left and right)

Every 2 seconds I am running a javascript on FrameLeft:
<script src="main.js"></script>

<script language="javascript">
function reloadpage()
{
window.setTimeout( "reloadpage()", 2000);
getInfo()
}
</script>

<title>Test</title>
</head>

<body onLoad="reloadpage();">


Where main.js:
function createRequestObject(){
var request_;
var browser = navigator.appName;
if(browser == "Microsoft Internet Explorer"){
 request_ = new ActiveXObject("Microsoft.XMLHTTP");
}else{
 request_ = new XMLHttpRequest();
}
return request_;
}
var http = createRequestObject();
function getInfo(){
http.open('get', 'refreshright.php');
http.send(null);
}


And refreshright.php:
<?php
session_start();
$nbmemberold=$_SESSION['$nbmemberold'];
$nbmember=0;
@$dbh=mysql_connect ("localhost", "database" , "password") or die ('There was a problem connecting to the database - please press refresh');
@mysql_select_db ("database");
$query = "SELECT * FROM membersonline";
$result = mysql_query($query) or die ("There was a problem connecting to the database - please press refresh");

while ($row = mysql_fetch_array($result))
  {
     extract($row);
$nbmember=$nbmember+1;
}

if ( $nbmember != $nbmemberold ) {
?>

<script language="javascript">
parent.frames["FrameRight"].location.reload();
</script>

<?php
}
$_SESSION['$nbmemberold']=$nbmember;
?>

Ok.. it doesn't work >.> <.< >.<
It took me some times to adapt the Ajax javascript and I've run some test so I know it is running refreshright.php - BUT the parent.frames["FrameRight"].location.reload(); doesn't work ???
I think its because of the way the php file is called .. well I guess thats why anyway.

Can anyone think about a way to make this java / php / parent.frames["FrameRight"].location.reload(); work ??

Thanks.





Similar Threads
Thread Thread Starter Forum Replies Last Post
Ch 8: <asp:image> inside <a> & ext.CSS (pg. 274) epc BOOK: Beginning ASP.NET 3.5 : in C# and VB BOOK ISBN: 978-0-470-18759-3 1 July 12th, 2008 04:37 AM
<style> tags in a <body> vs. <div> bcat BOOK: Beginning CSS: Cascading Style Sheets for Web Design ISBN: 978-0-7645-7642-3 1 March 27th, 2005 08:50 AM
<marquee><b>About CHAT App. in PHP4</b></marquee> Ramkrishna PHP How-To 1 September 11th, 2004 07:01 AM
<STRONG> vs <B> and <EM> vs <I> anshul HTML Code Clinic 12 September 1st, 2004 05:22 PM
a problem in book<<beginning asp.net using vb>> luoware ASP.NET 1.0 and 1.1 Basics 3 December 8th, 2003 09:32 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.