473,804 Members | 3,156 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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("SE LECT linestate FROM broad WHERE num='40'");
$linest = mysql_fetch_arr ay($st);
$linestate= $linest["linestate"];
if ($linestate=='0 ')
{
echo "<script language=\"Java Script\">";
echo "window.locatio n.replace(\"upd ate.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 3066
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("SE LECT linestate FROM broad WHERE num='40'");
$linest = mysql_fetch_arr ay($st);
$linestate= $linest["linestate"];
if ($linestate=='0 ')
{
echo "<script language=\"Java Script\">";
echo "window.locatio n.replace(\"upd ate.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('SE LECT linestate FROM broad WHERE num=40');
$linest = mysql_fetch_arr ay($st);
if ($linest !== FALSE)
{
$linestate = $linest['linestate'];
if ($linestate === '0')
{
?>
<script type="text/javascript">
window.location .replace("updat e.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.de mon.co.uk>
Oct 1 '08 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

11
3152
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 of making the ajax refresh process this. Thanks Mike
3
2909
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 username and password I send this information by XMLrequest to php file which verify the user name and the password if trure open the sesstion and get it name 'user' its become like this $_SESSION=$user;
0
5524
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 code what I think is a fairly typical Master/Detail scenario with two GridViews, using AJAX. Using the Northwind sample, I have two ObjectDataSources - one which pulls data from the Orders table, and one that pulls the related data from . Each...
10
3162
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. every 5 seconds, i just want to refresh it ONLY on server change just like desktop applications do. The problem is that refreshing evry n seconds has to much impact on my web server. The refresh action should be taken only when something
25
2562
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. every 5 seconds, i just want to refresh it ONLY on server change just like desktop applications do. The problem is that refreshing evry n seconds has to much impact on my web server. The refresh action should be taken only when something
10
3487
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 ------------- I have perl script which simply runs a ps on a Solaris server and generates a static html page with all of the code perfectly and this html page works fine when viewing it statically or with a META REFRESH header tag. The idea is to give the user...
1
1448
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 repeateritems, pull some values from a few literals, pass the values to the webservice and then refresh that update panel for that repeater item. This means panel 1 is the first one to refresh before I move on to panel 2 and so forth. This currently...
5
3209
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 user gets a new message. Obviously I would have one message icon which doesn't flash and another which does. Right now i refresh the top frame every 30 seconds so that the stats update. But is there an easier way to refresh? I mean right now the...
1
981
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
9706
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10575
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10330
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10319
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10076
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9144
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7616
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5651
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
2990
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.