473,418 Members | 2,093 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,418 software developers and data experts.

DUMB question ? Server trip without a page refresh or reload possible ?

Mel
i would like to have a link, such that when the user clicks on it, a script
is fired to go to server and check for page updates, if any, it should
request a reload, else stay silend (terminate)

is such thing possible ?

thanks
Jul 23 '05 #1
4 2593


Mel wrote:
i would like to have a link, such that when the user clicks on it, a script
is fired to go to server and check for page updates, if any, it should
request a reload, else stay silend (terminate)

is such thing possible ?


<form action="">
then make the page an ASP or PHP (or whatever you use on the server) and
let it return the HTTP status code 204 if there is no new data,
otherwise send the new data.
--

Martin Honnen
http://JavaScript.FAQTs.com/
Jul 23 '05 #2
Mel
how can i return "HTTP status code 204" from my cgi script ?

any example is appreciated
"Martin Honnen" <ma*******@yahoo.de> wrote in message
news:42***********************@newsread2.arcor-online.net...


Mel wrote:
i would like to have a link, such that when the user clicks on it, a script is fired to go to server and check for page updates, if any, it should
request a reload, else stay silend (terminate)

is such thing possible ?


<form action="">
then make the page an ASP or PHP (or whatever you use on the server) and
let it return the HTTP status code 204 if there is no new data,
otherwise send the new data.
--

Martin Honnen
http://JavaScript.FAQTs.com/

Jul 23 '05 #3

if you make sure that your clients have jscript activated ( i never ge
it why the MAJORITY doesnot chekc for this but uses jscript comman
which result than in NULL repsponse to the user if he switched o
jscript) than you can use XmlHTTP to communicated with the server.

Of course this is once again a pain with cross browser functionality
so best is you do a jscript class checking which browser calls an
creating the correct object.

See the XmlHttp docs for IE and Mozilla.

Joe Robe
Mel Wrote:
how can i return "HTTP status code 204" from my cgi script ?

any example is appreciated
"Martin Honnen" ma*******@yahoo.de wrote in message
news:42***********************@newsread2.arcor-online.net...-
Mel wrote:
-
i would like to have a link, such that when the user clicks on it
a--
script--
is fired to go to server and check for page updates, if any, i
should
request a reload, else stay silend (terminate)

is such thing possible ?-

form action=""
then make the page an ASP or PHP (or whatever you use on the server
and
let it return the HTTP status code 204 if there is no new data,
otherwise send the new data.
--

Martin Honnen
http://JavaScript.FAQTs.com/


--
joer00
Jul 23 '05 #4


Mel wrote:
how can i return "HTTP status code 204" from my cgi script ?


How about looking in the documentation of your favourite CGI
language/package on how to set HTTP response codes?
As you are asking in a JavaScript group I will show you an ASP solution
with JavaScript, if that doesn't help you then use an appropriate group
for your server side language, after checking its documentation and FAQ
list.

<%@ Language="JavaScript" %>
<%
function checkForUpdates () {
// simply returning a number here
return Math.floor(Math.random() * 10) + 1;
}
var update = checkForUpdates();
if (update < 5 && Request.ServerVariables('REQUEST_METHOD') == 'POST') {
Response.Status = '204 No Content';
Response.End();
}
%>
<html lang="en">
<head>
<title>form updated occasionally</title>
</head>
<body>
<form action="" method="POST">
<div>
<label>
user value:
<input type="text" name="uservalue">
</label>
<input type="submit" value="check for updates">
</div>
<div>
<span>
updated value:
<%= update %>
</span>
</div>
</form>
</body>
</html>

--

Martin Honnen
http://JavaScript.FAQTs.com/
Jul 23 '05 #5

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

Similar topics

8
by: Michele | last post by:
Hi all, I have developed a PHP-based website where a "planner" user can make up schedules of activities to be performed, storing them into MySQL tables. Afterwards, other "watcher" users can...
5
by: Bryan Field-Elliot | last post by:
We're designing a web app in which some operations will take a long time to complete (maybe two minutes). Because it's a high-volume application, we don't want browser connections hanging open for...
13
by: long5120 | last post by:
I am trying to use webpage with javascript to check if a web server is responding. I was thinking of using 2 frames. Frame1 will have the site, and the Frame2 will be a status bar (not really...
3
by: Kurita Kinoshita | last post by:
I'm trying to find a way to have a script communicate with a server without having to load a new page. The idea is to have the server act as a simple wrapper for a database, letting the client do...
5
by: lucanos | last post by:
Hey Guys, Hoping that you can help me, as I have been scratching my head and getting nothing but dandruff... SITUATION --------- I have a webpage which users will be viewing, which has forms...
17
by: Zvi Danovich | last post by:
Hi, I am a newby in ASP.NET, and till now wrote only simple "classic" WEB-sites. But - the time came, and now I need that: 1. Server will "listen" for some events on its local machine 2....
10
by: phforum | last post by:
Hi, I wrote a PHP page for user input the information to search the database. And the database data will update every second. I want to set the auto refresh to get the data from database every...
2
by: Max | last post by:
Is it possible to reload a web page on user browser when an event occurs at server side? For example when user A places an order, user B should be notified of that and should see that order on his...
5
by: =?Utf-8?B?Sm9obg==?= | last post by:
Hi, I used the following code to refresh the parent page, and it works very well (Thanks to Peter Bromberg "). Response.Write("<script language='javascript' type='text/javascript'{...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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...

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.