By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
434,741 Members | 2,009 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 434,741 IT Pros & Developers. It's quick & easy.

AJAX refresh

P: n/a
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
Share this Question
Share on Google+
1 Reply


P: n/a
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.