Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Javascript > how to handle this AJAX error?

Reply
Thread Tools

how to handle this AJAX error?

 
 
pete
Guest
Posts: n/a
 
      08-02-2010
Hi everybody --

I'm only starting with AJAX. I have a button on the html page that
overloads a table with new, up-to-date markup and content. Three out
of four times under FF 3.6.8, this works great. But it often yields
the infamous (to many) and mysterious (to me) error report:

uncaught exception: [Exception... "Component returned failure code:
0x80004005 (NS_ERROR_FAILURE) [nsIXMLHttpRequest.send]" nsresult:
"0x80004005 (NS_ERROR_FAILURE)" location: "JS frame :: http://www.the
domain.com/cgi-bin/cgicode :: submit :: line 1183" data: no]

Google yields tons of questions (going back years) about this error,
but I haven't found too many helpful answers. One common, unhelpful
suggestion is to get rid of the X FIrefox plugin.

So: can anyone tell me what this message means; which readystate the
thing comes from; and what I can do to correct whatever error the
message is talking about? I do notice the "data: no" in the msg, and I
sure can reissue the request. But is that the correct -- and
foolproof; and only -- thing to do?

Thanks, all. I appreciate any help. This thing is making me crazy.

-- pete
 
Reply With Quote
 
 
 
 
David Mark
Guest
Posts: n/a
 
      08-02-2010
On Aug 2, 5:47*am, pete <(E-Mail Removed)> wrote:
> Hi everybody --
>
> I'm only starting with AJAX. I have a button on the html page that
> overloads a table with new, up-to-date markup and content. Three out
> of four times under FF 3.6.8, this works great.


Exactly three out of four times?

> But it often yields
> the infamous (to many) and mysterious (to me) error report:


One out of four is not often.

>
> uncaught exception: [Exception... "Component returned failure code:
> 0x80004005 (NS_ERROR_FAILURE) [nsIXMLHttpRequest.send]" nsresult:
> "0x80004005 (NS_ERROR_FAILURE)" location: "JS frame ::http://www.the
> domain.com/cgi-bin/cgicode :: submit :: line 1183" data: no]


For something so famous, I can't recall seeing it.

>
> Google yields tons of questions (going back years) about this error,


Searching for answers to JS questions on Google is rarely fruitful.
There are just too many confused people out there.

> but I haven't found too many helpful answers.


What helpful answers have you found?

> One common, unhelpful
> suggestion is to get rid of the X FIrefox plugin.


Sounds like a typical stab in the dark.

>
> So: can anyone tell me what this message means; which readystate the
> thing comes from;


It appears to happen on calling the send method.

> and what I can do to correct whatever error the
> message is talking about?


Hard to say without seeing your code.

> I do notice the "data: no" in the msg, and I
> sure can reissue the request. But is that the correct -- and
> foolproof; and only -- thing to do?


Do what? Ignore the error and carry on?

>
> Thanks, all. I appreciate any help. This thing is making me crazy.
>


It's not doing me any good either.
 
Reply With Quote
 
 
 
 
Thomas 'PointedEars' Lahn
Guest
Posts: n/a
 
      08-02-2010
pete wrote:

> I'm only starting with AJAX. I have a button on the html page that
> overloads a table with new, up-to-date markup and content. Three out
> of four times under FF 3.6.8, this works great. But it often yields
> the infamous (to many) and mysterious (to me) error report:
>
> uncaught exception: [Exception... "Component returned failure code:
> 0x80004005 (NS_ERROR_FAILURE) [nsIXMLHttpRequest.send]" nsresult:
> "0x80004005 (NS_ERROR_FAILURE)" location: "JS frame :: http://www.the
> domain.com/cgi-bin/cgicode :: submit :: line 1183" data: no]
>
> Google yields tons of questions (going back years) about this error,
> but I haven't found too many helpful answers. One common, unhelpful
> suggestion is to get rid of the X FIrefox plugin.


It is possible, but rather unlikely that a plugin (or, what you probably
mean instead, an extension) is the culprit in your case. (I have never
heard of an "X plugin" before, BTW.) You should have posted the relevant
parts of your code and the *exact* error message (with the exact domain
name) for further analysis, see also <http://jibbering.com/faq/#posting>.
Without that, only educated guesses (or flippant, yet somewhat justified,
responses) are left.

Chances are that everything works as designed, that you are using the same
XHR instance for two or more concurrent HTTP requests. In that case there
would be a race condition: The send() method can only be called on an XHR
instance if that instance has been initialized (open() has been called on
it) but is not already sending a request or handling a response (i.e., the
value of the `readyState' property is either 1 or 4). There would be no
problem if the response for the first request was processed completely
before you make the second request; otherwise the exception above would be
thrown, and since you would not catch it, logged to the Error Console (and
the script would terminate afterwards). The latter can happen in your
application if any of the following applies: You click the button in short
succession, your Internet connection is slower than usual, your Web server
is slower to respond than usual.

You would either need to use two different XHR instances then, or you would
need to wait with the second request until the first response has been fully
received (readyState == 4, in the latter case to be checked against in the
function referred to by the value of the `onreadystatechange' property of
the instance). (Therefore, a good XHR library should IMHO recognize the
condition of the XHR instance and create a new instance only when necessary,
in order to save heap memory, if the request parameters and the response
handler are the same as before.)

You can check the Mozilla source code (written in C++, not that hard to
understand for a JS/ES developer) to be sure about the cause of the
exception. Searching the corresponding code branch (see: Help menu, About…
item, "rv:…") on <http://mxr.mozilla.org/> (or even on Google!) for the
identifier "nsIXMLHttpRequest" (see the error message) would most certainly
prove helpful then. Incidentally, there is a posting from me from March
2006 (CE) that explains this very problem. Google lists it right on top for
at least `NS_ERROR_FAILURE nsIXMLHttpRequest' (you see, NS_ERROR_FAILURE is
a general error code in Mozilla; *context* is key.)


HTH

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, <f806at$ail$1$(E-Mail Removed)>
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: How include a large array? Edward A. Falk C Programming 1 04-04-2013 08:07 PM
AJAX IDE and AJAX TOOL--The Release of JoyiStar AJAX WebShop 3 Beta minnie Java 1 12-13-2006 06:29 AM
Possible to handle web requests without an ASPX page? i.e. have DLL handle request. jdlwright@shaw.ca ASP .Net 2 05-31-2005 05:42 PM
how to handle command line output(not terminal handle) Leon Python 2 11-04-2004 05:16 AM
File Handle Reading Blues: Rereading a File Handle for Input Dietrich Perl 1 07-22-2004 10:02 AM



Advertisments