473,398 Members | 2,188 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,398 software developers and data experts.

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 3011
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

11
by: John Smith | last post by:
I am using Ajax to refresh a DIV area by setting the innerHTML=request.responseText in the usual manner. in the response text I have a <SCRIPT> tag in line, but this is not executed. Is there a way...
3
by: Beshoo | last post by:
hey gaiz plz I want to cerate log in system in ajax i do it but i have one problem AFTER I start thes session then press refresh key the session gone !!! in other words , after the user type hid...
0
by: Phillip Ian | last post by:
Tried this over in CSharp.General and didn't get anything, so I thought I'd try again here. If there's an AJAX specific group I could ask this in, please let me know...I did look. I'm trying to...
10
by: Piotr Nowak | last post by:
Hi, Say i have a server process which listens for some changes in database. When a change occurs i want to refresh my page in browser by notyfinig it. I do not want to refresh my page i.e....
25
by: Piotr Nowak | last post by:
Hi, Say i have a server process which listens for some changes in database. When a change occurs i want to refresh my page in browser by notyfinig it. I do not want to refresh my page i.e....
10
by: paulie | last post by:
Hi, I have been experiencing an issue when trying to use AJAX to reload a DIV area using a timer of 2000ms, which contains a html page with another DIV and javascript. Scenario -------------...
1
by: Nightcrawler | last post by:
I have a parent updatepanel with a repeater in it that generates 10 child updatepanels. I have one button that will refresh all these 10 updatepanels. On the button click I go through the...
5
by: Kaante | last post by:
Hi, I basically have two frames on my page, the top one contains users stats and the bottom frame contains the website. I want to have a message icon on the top frame which would flash once the...
1
by: luigi.corrias | last post by:
Hello everybody, this is a very difficult question… imagine 2 webform asp.net A and B B is an iframe inside A..
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.