Hi,
I was wondering if somebody knows a simple way to update a (status) text in PHP without refressing. The situation is as follows;
I have a class that scrawls a domain and gathers the keyword denstity of a certain page within that domain. Now I want to show the user what the status is of the task (in %). Maybe I can use ob_flush() or flush() in combination with IFRAMES, but I prefer to don't. The problem with AJAX for as far as I know is that it won't accept flush and you cant make it holding a connection online (readystate -it just accepts status 3/4-).
On the otherside I also want the script to run on the background. So the user can still surf on the website while the script is generating. When the script is ready it should attent the user (with a popup or something).
I can do that by listening to a socket till the script is done but I dont know if that is the best way.
2 1392 Atli 5,058
Recognized Expert Expert
Hi.
I suppose this is possible by using Javascript. (It won't be pretty tho :P)
You could, for example, create a <div> or <span> at the top, naming it something like 'progress', and have PHP echo a Javascript snipped at certain intervals, changing the contents of the 'progress' container.
Somewhat like: -
<pre>
-
<span id="progress">0</span>% complete
-
</pre>
-
-
<?php
-
ob_start();
-
while($something)
-
{
-
# Do something...
-
-
$percentComplete++;
-
echo "\n
-
<script type=\"text/javascript\">
-
document.getElementByID('progress').innerHTML = '{$percentComplete}';
-
</script>";
-
ob_flush();
-
flush();
-
}
-
?>
-
Hi Atli,
Sorry I was out for a while...I'am familiar with the javascript way,I jus't didn't know it was the proper way to do it.
Thanks anyway... :D
p.s You have an idea about the background running task?
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: K |
last post by:
I have found a script online that I want to use (I am new to PHP).
It creates dynamic images based on the text that you pass it.
However, no matter how I try, I can't get anything other than a blank white
image.
Can one of you knowledgeable people please have a look at the code below and
help please.
|
by: pysim |
last post by:
Hi, I have a couple of general requests for pointers to python
examples and design advice.
I'm looking for examples of MVC-based GUI controls done in python
(model-view-controller).
Also, examples where something like a simulation model running in its
own thread sends fast updates to a GUI in near real-time. The only
examples I've seen, such as SimPy, wait until the model is finished
running before outputting data.
|
by: rob |
last post by:
Hi All,
I have an asp script which updates upto 300000 records each time it is run.
I would like to have a textbox which says records progressed : then in
increments of 100 or 1000 whilst the script is running. Is this possible to
do with a textbox? I've tried using the response.flush with a variable
which kinda works but it displays as follows;
1000
2000
3000
|
by: JOSEPHINE ALVAREZ |
last post by:
I have this code that I want to use to do a rollover. However, because the
company I am doing it for is continually changing the text, I want to be
able to use dynamic text to change the text on the fly, and still have the
rollover work. I have taken the text off of the buttons, but cannot figure
out how to do it with dynamic text using javascript and html.
For example, in the columns of this row, I want to put "About...
|
by: Paul Hatcher |
last post by:
I have an ASP.NET application that uses a background threads to perform a
long-running process. What I'm not sure is how to track and communicate with
the thread.
The site is divided up into sections, each of which could have it's own
background process. Given that any user should be able to inquire against
the current status of a process thread, I don't know how to keep a reference
to it unless I just put it into Global.asax, which...
| |
by: James |
last post by:
Hi
Has anybody had any experience of ASP.Net performance counters not updating.
In the performance monitor application when I try to add the groups ASP.NET
and ASP.NET Applications the counters all show 0. In addition, ASP.NET
Applications does not show any of the ASP.NET instances that are running on
the computer. The other counters for example % processor time work fine.
The problem machine is a test server running Win2003. ...
|
by: MgGuigg |
last post by:
Hello all, This is my first time posting a question to this forum, so here is
hoping I am following protocol. I am scraping the rust off my old Basic
programming skills, and have just recently upgraded to VB.NET, and I have a
lot of catching up to do. That being said, I have come a long way in a short
while, however, I am stumped at the moment. I have read through days of
posts, but have not been able to address my specific question, so...
|
by: rdemyan via AccessMonster.com |
last post by:
My application is calculation intensive and the servers are agonizingly slow.
Administrators of my application only update the backends once a month (twice
a month max). So, my launching program allows the back-end file to be
downloaded to the user's PC. This will provide maximum speed for these
calculations/manipulations of data. Without this, just logging into the main
app connected to the server back-end file can take five minutes...
|
by: Analizer1 |
last post by:
From what im reading about backgroundworker thread
it seems it can only have 1 thread at a time
is this correct
tks
|
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...
|
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
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...
|
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,...
|
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...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
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...
| |