Hi,
I want to asynchronously recieve large amount of data using
XMLHTTPRequest. If it is possible, I would like to make a
progress bar to show the user how the process is going.
According to the information I found, the object can only be
in five states (shown below). Is it possible to see how much
data has already been recieved when the object is in state 3?
XMLHttpRequest.readyState:
0 The object has been created, but not initialized (the open
method has not been called).
1 The object has been created, but the send method has not
been called.
2 The send method has been called, but the status and headers
are not yet available.
3 Some data has been received. Calling the responseBody and
responseText properties at this state to obtain
partial results will return an error, because status
and response headers are not fully available.
4 All the data has been received, and the complete data is
available.
If you know of some alternative way to make a progress bar for
this purpose, let me know. 10 11291
test wrote: Hi,
I want to asynchronously recieve large amount of data using XMLHTTPRequest. If it is possible, I would like to make a progress bar to show the user how the process is going.
According to the information I found, the object can only be in five states (shown below). Is it possible to see how much data has already been recieved when the object is in state 3?
XMLHttpRequest.readyState:
0 The object has been created, but not initialized (the open method has not been called). 1 The object has been created, but the send method has not been called. 2 The send method has been called, but the status and headers are not yet available. 3 Some data has been received. Calling the responseBody and responseText properties at this state to obtain partial results will return an error, because status and response headers are not fully available. 4 All the data has been received, and the complete data is available.
If you know of some alternative way to make a progress bar for this purpose, let me know.
You could do it by only sending X data of a request at a time, then
requesting the next X segment of your total data N. Something like
this...
<part>
<bytesSent>1256</bytesSent>
<bytesTotal>102325</bytesTotal>
<data>insert whatever data you are sending here, part of the
whole</data>
</part>
Keep requesting the next part of N data, reading, updating your page,
until you have bytes total.
test wrote: If you know of some alternative way to make a progress bar for this purpose, let me know.
Sorry, I don't help anonymous address mungers.
<URL:http://www.interhack.net/pubs/munging-harmful/>
PointedEars
Thomas 'PointedEars' Lahn wrote: Sorry, I don't help anonymous address mungers. <URL:http://www.interhack.net/pubs/munging-harmful/>
Yet you waste everyone's time posting stupid responses like this?
Or ones that simply say "RTFM"?
Come on, please don't litter this group with more junk than it already has!
--
Matt Kruse http://www.JavascriptToolbox.com http://www.AjaxToolbox.com
salute Mr. test According to the information I found, the object can only be in five states (shown below). Is it possible to see how much data has already been recieved when the object is in state 3?
XMLHttpRequest.readyState: ... 3 Some data has been received. Calling the responseBody and responseText properties at this state to obtain partial results will return an error, because status and response headers are not fully available.
.... and yet it is worth a try to access some of these informations.
listen to the [[XMLHttpRequest]] objects "onreadystatechange".
as long as the objects "readyState" returns its interactive status 3
try to read the objects "responseStream.length" property and as this
fails the objects "responseText.length" property as well.
when I did research in order to script just another XMLHttpRequest
interface I found "responseStream" only (no other reference states
something to "responseStream") at
[ http://msdn.microsoft.com/library/en...sp?frame=true]
and I implemented it - but my test running in MSIE always switches
to the "responseText.length" fallback.
now you got the information about the objects "bytesLoaded".
you will receive the objects "totalBytes" as result of the following
header query: [[XMLHttpRequest]].getResponseHeader("Content-Length");
the rest simply is Math.
you might countercheck my test as a feasibility study at
[ http://www.pseliger.de/testCases/dht...face.dev.html]
so long - peterS.
Matt Kruse wrote: Thomas 'PointedEars' Lahn wrote: Sorry, I don't help anonymous address mungers. <URL:http://www.interhack.net/pubs/munging-harmful/>
Yet you waste everyone's time posting stupid responses like this?
What you call a stupid response and a waste of time, I call giving a hint,
so that OPs recognize why they do not receive help (from me) even though it
would have been possible, and therefore giving them an incentive to change
their antisocial behavior.
PointedEars
Thomas 'PointedEars' Lahn said the following on 3/31/2006 8:33 AM: Matt Kruse wrote:
Thomas 'PointedEars' Lahn wrote: Sorry, I don't help anonymous address mungers. <URL:http://www.interhack.net/pubs/munging-harmful/> Yet you waste everyone's time posting stupid responses like this?
What you call a stupid response and a waste of time,
Is a stupid response and a waste of time. Call it what it is.
I call giving a hint,
99.99% of the post in this group can be answered with an RTFM. Its a
stupid, useless response. Its not a hint.
so that OPs recognize why they do not receive help (from me) even though it would have been possible, and therefore giving them an incentive to change their antisocial behavior.
Practice what you preach, please?
--
Randy
comp.lang.javascript FAQ - http://jibbering.com/faq & newsgroup weekly
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
On 31 Mar 2006 01:38:36 -0800, peterS. wrote: salute Mr. test
According to the information I found, the object can only be in five states (shown below). Is it possible to see how much data has already been recieved when the object is in state 3?
XMLHttpRequest.readyState: ... 3 Some data has been received. Calling the responseBody and responseText properties at this state to obtain partial results will return an error, because status and response headers are not fully available.
... and yet it is worth a try to access some of these informations.
listen to the [[XMLHttpRequest]] objects "onreadystatechange". as long as the objects "readyState" returns its interactive status 3 try to read the objects "responseStream.length" property and as this fails the objects "responseText.length" property as well.
when I did research in order to script just another XMLHttpRequest interface I found "responseStream" only (no other reference states something to "responseStream") at [http://msdn.microsoft.com/library/en...sp?frame=true] and I implemented it - but my test running in MSIE always switches to the "responseText.length" fallback.
now you got the information about the objects "bytesLoaded". you will receive the objects "totalBytes" as result of the following header query: [[XMLHttpRequest]].getResponseHeader("Content-Length");
the rest simply is Math.
you might countercheck my test as a feasibility study at [http://www.pseliger.de/testCases/dht...face.dev.html]
so long - peterS.
Thanks!
But I seem to have a problem: I don't recieve the
"Content-Length" header. According to Firefox's Firebug
extension, I get these headers:
GET http://localhost/mytestsite/getmessages.php?param=0
Headers:
Date: Fri, 31 Mar 2006 19:53:20 GMT
Server: Apache/2.0.54 (Win32) mod_ssl/2.0.54 OpenSSL/0.9.8
PHP/5.0.5 mod_autoindex_color
X-Powered-By: PHP/5.0.5
Keep-Alive: timeout=15, max=98
Connection: Keep-Alive
Transfer-Encoding: chunked
Content-Type: text/html
Is it something I have to set on the server? How?
On Fri, 31 Mar 2006 22:06:07 +0200, test wrote:
[...] Is it something I have to set on the server? How?
OK, I've set it on the php side with:
header('Content-length: '.filesize($file));
Thanks again for your reply :)
JRS: In article <13****************@PointedEars.de>, dated Fri, 31 Mar
2006 15:33:09 remote, seen in news:comp.lang.javascript, Thomas
'PointedEars' Lahn <Po*********@web.de> posted : Matt Kruse wrote:
Thomas 'PointedEars' Lahn wrote: Sorry, I don't help anonymous address mungers. <URL:http://www.interhack.net/pubs/munging-harmful/>
Yet you waste everyone's time posting stupid responses like this?
What you call a stupid response and a waste of time, I call giving a hint, so that OPs recognize why they do not receive help (from me) even though it would have been possible, and therefore giving them an incentive to change their antisocial behavior.
Your manner of posting is itself antisocial behaviour; follow,
therefore, your own advice. When you have nothing useful to say, then
say nothing.
You seem to consider yourself to have been elected fuehrer of this
newsgroup - you are mistaken.
While your technical ability is, although unreliable, acknowledged,
opinions on you evidently vary. Sometimes you are despised, sometimes
you are hated, but most often you seem to be considered psychologically
inadequate or mentally malformed. Even your fellow Germans over in
de.c.l.j seen to hold similar views.
--
© John Stockton, Surrey, UK. ?@merlyn.demon.co.uk Turnpike v4.00 MIME ©
Web <URL:http://www.uwasa.fi/~ts/http/tsfaq.html> -> Timo Salmi: Usenet Q&A.
Web <URL:http://www.merlyn.demon.co.uk/news-use.htm> : about usage of News.
No Encoding. Quotes before replies. Snip well. Write clearly. Don't Mail News.
Thomas 'PointedEars' Lahn wrote: What you call a stupid response and a waste of time, I call giving a hint, so that OPs recognize why they do not receive help (from me) even though it would have been possible, and therefore giving them an incentive to change their antisocial behavior.
(1) If everyone took each thread that they didn't think was worthy of a
response, and responded to tell the OP this fact, that would be extremely
stupid, no?
(2) You act as if someone should be privileged to receive a response from
you. Not so. Your responses are often less than helpful, so not getting a
response from you is hardly something someone should be concerned about.
(3) "Anti-social" describes _most_ of your posts to this group. You are
perhaps the least social regular poster to this group. Do you have an
incentive to change _your_ anti-social behavior?
(4) You are not net cop. Please use personal email to send critiques of
posting style, rather than posting here.
I realize that me posting to do nothing but criticize your posting style is
perhaps a bit ironic and perhaps unnecessary. But good god, sometimes your
rudeness and pointlessness really goes overboard.
--
Matt Kruse http://www.JavascriptToolbox.com http://www.AjaxToolbox.com This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: John Salerno |
last post by:
My code is below. The main focus would be on the OnStart method. I want
to make sure that a positive integer is entered in the input box. At
first I tried an if/else clause, then switched to...
|
by: pamelafluente |
last post by:
Hi Guys,
I have the following HTML code which is doing a GET to a page, say
MyUrl.aspx :
<body>
<form name="form1" method="get" action="MyUrl.aspx" id="form1">
<input type="hidden"...
|
by: libsfan01 |
last post by:
Hi all
I want to have create a js function to use xmlhttprequest continously
check a given url for any change in its value and then bring the
contents of that page through.
Here is my code so...
|
by: Chandra |
last post by:
How do I programmatically (javascript) check if link is valid in html?
|
by: geevaa |
last post by:
http://www.phpbuilder.com/columns/kassemi20050606.php3
XMLHttpRequest and AJAX for PHP programmers
James Kassemi
Introduction:
Although the concept isn't entirely new, XMLHttpRequest...
|
by: Mike P |
last post by:
I am trying to apply the Update Progress control to a method that is
building a zip file and then giving the user the chance to save the file
via a popup box. But the Update Progress control...
|
by: avicalc |
last post by:
I need help with the structure of a JavaScript program. My process is
as follows:
1) Get JSON data via XMLHttpRequest.
2) When done with the above, process the JSON data which may take up
to 3...
|
by: canabatz |
last post by:
i got this php file 'check.php' that checks for changes ,and showing a counter for posts !!
$show_data="SELECT * FROM bidding_main WHERE bid_id='$bid_id' ";...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
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
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
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...
|
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...
|
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,...
|
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...
|
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: 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,...
| |