469,356 Members | 2,618 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,356 developers. It's quick & easy.

AJAX refresh

Hello
I use a AJAX refresh script on a page to test a $var state

<div>
<?
include ("include/refr.inc.php");
//ajax script for reload
require ("bd_inc.php");
//test the line state buzy or free
$st = mysql_query("SELECT linestate FROM broad WHERE num='40'");
$linest = mysql_fetch_array($st);
$linestate= $linest["linestate"];
if ($linestate=='0')
{
echo "<script language=\"JavaScript\">";
echo "window.location.replace(\"update.php\")";
echo "</script>";
}
else .........

unfortunely it work with all instructions I have tested but redirection
instructions are not working
If I just use a simple meta refresh without ajax it work
Any idea ?

Oct 1 '08 #1
1 2826
christian wrote:
I use a AJAX refresh script on a page to test a $var state

<div>
<?
include ("include/refr.inc.php");
//ajax script for reload
require ("bd_inc.php");
//test the line state buzy or free
$st = mysql_query("SELECT linestate FROM broad WHERE num='40'");
$linest = mysql_fetch_array($st);
$linestate= $linest["linestate"];
if ($linestate=='0')
{
echo "<script language=\"JavaScript\">";
echo "window.location.replace(\"update.php\")";
echo "</script>";
}
else .........

unfortunely it work with all instructions I have tested but redirection
instructions are not working
If I just use a simple meta refresh without ajax it work
Any idea ?
You have yet to learn PHP and HTML to begin with:

<div>
<?php
include 'include/refr.inc.php';

// ajax script for reload
require 'bd_inc.php';

// test the line state buzy or free
$st = mysql_query('SELECT linestate FROM broad WHERE num=40');
$linest = mysql_fetch_array($st);
if ($linest !== FALSE)
{
$linestate = $linest['linestate'];
if ($linestate === '0')
{
?>
<script type="text/javascript">
window.location.replace("update.php");
</script>
<?php
}
else .........
}
?>

Unfortunately, you have omitted the relevant parts. When analyzing and
posting problems with *client-side* scripts, you should look at and post the
*client-side* code, not the server-side one -- View the Source, Luke!
See also <http://jibbering.com/faq/>. And fix your sender address.
PointedEars
--
Prototype.js was written by people who don't know javascript for people
who don't know javascript. People who don't know javascript are not
the best source of advice on designing systems that use javascript.
-- Richard Cornford, cljs, <f8*******************@news.demon.co.uk>
Oct 1 '08 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

11 posts views Thread by John Smith | last post: by
3 posts views Thread by Beshoo | last post: by
reply views Thread by Phillip Ian | last post: by
10 posts views Thread by Piotr Nowak | last post: by
25 posts views Thread by Piotr Nowak | last post: by
1 post views Thread by Nightcrawler | last post: by
5 posts views Thread by Kaante | last post: by
1 post views Thread by luigi.corrias | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by zhoujie | last post: by
reply views Thread by suresh191 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.