XMLHTTP TimeOut

M

Marcos

Hello,

Is possible to determine the timeout of XMLHTTP Request?

My solicitations using the XMLHTTP they are giving error and
this because the page it is delaying a little more to send the result
to the XMLHTTP...

Thanks,
 
M

Marcos

Around of Six seconds, in local test.

If help, the code is:

function getcategories(xmlhttp)
{
if(xmlhttp)
{

xmlhttp.open("GET", "MYPAGE",true);
xmlhttp.onreadystatechange=function()
{
if(xmlhttp.readyState==4)
{
if(xmlhttp.status==200)
{window.opener.document.getElementById('c_categories').value =
xmlhttp.responseText;}
if(xmlhttp.status==404) alert("Page not Found");
}
}
xmlhttp.send(null);
alert("Your Choise was stored");
self.close(); // Close the window
}

I already change the
window.opener.document.getElementById('c_categories').value =
xmlhttp.responseText; to alert(xmlhttp.responseText) for test and the
problem continues.

Thanks.
 
M

Matt Kruse

Marcos said:
Is possible to determine the timeout of XMLHTTP Request?
My solicitations using the XMLHTTP they are giving error and
this because the page it is delaying a little more to send the result
to the XMLHTTP...

A browser's timeout using XMLHttpRequest should be the same as its normal
timeout period for any other request.

How long is your server taking to deliver the result?
 
M

Marcos

Could you post an example URL?

Yes. I Can.

xmlhttp.open("GET",
"apps.php?call=navcategory&maxlimit="+maxlimit+"&selected_cat="+selected+ "&xmlactive=true&finish=true",true);

I have more informations, the firefox detected one error:

Error: [Exception... "Component returned failure code: 0x80040111
(NS_ERROR_NOT_AVAILABLE) [nsIXMLHttpRequest.status]" nsresult:
"0x80040111 (NS_ERROR_NOT_AVAILABLE)" location: "JS frame ::
http://200.138.105.166:45751/apps/js/category.js :: anonymous :: line
133" data: no]
Source File: http://200.138.105.166:45751/apps/js/category.js
Line: 133

Line 133:

if(xmlhttp.status==200)
{window.opener.document.etElementById('c_categories').value =
xmlhttp.responseText;}

If I get the address apps.php(etc..) and past in the browser the result is
returned correctly...

Any Idea?

--

Thanks,

Marcos José Setim
________________________________________
Usando o M2 do Opera: http://www.opera.com/m2/
 
M

Matt Kruse

Marcos said:
Around of Six seconds, in local test.

It times out in 6 seconds? Then it's surely not the browser timing out the
request. Something else is going on.
If help, the code is:

Could you post an example URL? The code is fine, but since there's probably
something else going on, we'd need to see the whole page to know for sure.
 
R

Richard Cornford

Marcos wrote:
xmlhttp.send(null);
alert("Your Choise was stored");
self.close(); // Close the window
<snip>

It is difficult to see closing the window from which you are making an
xml http request just after sending the request as a good idea.

Richard.
 
T

Thomas 'PointedEars' Lahn

Marcos said:
Could you post an example URL?

Yes. I Can.

xmlhttp.open("GET",
"apps.php?call=navcategory&maxlimit="+maxlimit+"&selected_cat="+selected+
"&xmlactive=true&finish=true",true);

1. <http://en.wikipedia.org/wiki/URL>

2.

xmlhttp.open(
"GET",
[
"apps.php?call=navcategory&maxlimit=", maxlimit,
"&selected_cat=", encodeURIComponent(selected),
"&xmlactive=true&finish=true"
].join(""),
true);
I have more informations, the firefox detected one error:

(more _information_)
Error: [Exception... "Component returned failure code: 0x80040111
(NS_ERROR_NOT_AVAILABLE) [nsIXMLHttpRequest.status]" nsresult:
"0x80040111 (NS_ERROR_NOT_AVAILABLE)" location: "JS frame ::
http://200.138.105.166:45751/apps/js/category.js :: anonymous :: line
133" data: no]
Source File: http://200.138.105.166:45751/apps/js/category.js
Line: 133

Line 133:

if(xmlhttp.status==200)

From the exception above, it appears that there is no `status' property
available here. Could be a cross-domain issue as you access the machine
with the IP address 200.138.195.166 instead of the current domain or
one of its subdomains.
{window.opener.document.etElementById('c_categories').value =
^^[1]

If `c_categories' is the ID of a form control, you should use

window.opener.document.forms[...].elements['c_categories'].value = ...;

If you access this object repeatedly, you should assign a reference
to a variable and use the variable instead to save lookups.

[1] Typo?


PointedEars
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,431
Messages
2,571,679
Members
48,796
Latest member
Greg L.

Latest Threads

Top