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

annoying javascript error

Hello all I am new to javascript and I am attempting to write a site in
JS / PHP to jump on the ajax band wagon. I am getting the following
error and have not been able to locate a solution for it yet. From
what I have read some people say it could have to do with xmlrequest
being busy or something like that.

Error: [Exception... "Component returned failure code: 0xc1f30001
(NS_ERROR_NOT_INITIALIZED) [nsIXMLHttpRequest.send]" nsresult:
"0xc1f30001 (NS_ERROR_NOT_INITIALIZED)" location: "JS frame :: mysite
:: getImage :: line 37" data: no]
Source File: mysite
Line: 37

thanks!

May 14 '06 #1
10 4600
seanism said the following on 5/14/2006 2:04 PM:
Hello all I am new to javascript and I am attempting to write a site in
JS / PHP to jump on the ajax band wagon.
Oh geez, another one.
I am getting the following error and have not been able to locate a
solution for it yet. From what I have read some people say it could
have to do with xmlrequest being busy or something like that.
Or one of another million SWAG's one could make.
Error: [Exception... "Component returned failure code: 0xc1f30001
(NS_ERROR_NOT_INITIALIZED) [nsIXMLHttpRequest.send]" nsresult:
"0xc1f30001 (NS_ERROR_NOT_INITIALIZED)" location: "JS frame :: mysite
:: getImage :: line 37" data: no]
Source File: mysite
Line: 37


My stereo doesn't work. Why?

The point being, you can't determine whats wrong with code that you
can't see.

--
Randy
comp.lang.javascript FAQ - http://jibbering.com/faq & newsgroup weekly
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
May 14 '06 #2
very true indeed.

<script type="text/javascript">
<!--
var results;

function vote(user_id, v){
// Build the URL to connect to
var url = "vote_ajax.php?id=" + results[0] + "&user_id="+ user_id +
"&vote=" + v;
request.abort();
// Open a connection to the server
request.open("GET", url, true);

// Setup a function for the server to run when it's done
request.onreadystatechange = window.location.reload( true );

// Send the request
request.send(null);
}

function getImage(){
// Build the URL to connect to
var url = "image_ajax.php";
// Open a connection to the server
request.open("GET", url, true);

// Setup a function for the server to run when it's done
request.onreadystatechange = changeImage;

// Send the request
request.send(null);
}

function changeImage(){
if (request.readyState == 4) {
// Split the comma delimited response into an array
results = request.responseText.split(",");
document.getElementById('image').innerHTML = results[2];
}

}
//-->
</script>

May 15 '06 #3
var request = false;
try{
// Mozilla/Safari
if (window.XMLHttpRequest)
request = new XMLHttpRequest();
// IE
else if (window.ActiveXObject)
request = new ActiveXObject("Microsoft.XMLHTTP");
}
catch (e) {
alert(e);
}
// Error

if(!request)
alert("XHR Object cannot create");

May 15 '06 #4
seanism said the following on 5/14/2006 8:50 PM:

Please quote what you are replying to.

If you want to post a followup via groups.google.com, don't use the
"Reply" link at the bottom of the article. Click on "show options" at
the top of the article, then click on the "Reply" at the bottom of the
article headers.

<URL: http://www.safalra.com/special/googlegroupsreply/ >
very true indeed.


Post a URL to a full sample page that displays the behavior and what
steps produce the error.
--
Randy
comp.lang.javascript FAQ - http://jibbering.com/faq & newsgroup weekly
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
May 15 '06 #5
rgr that Randy. Should I reply on the top or bottom of the quoted
information? Also is there an easy way to see what threads you
started? If I goto my profile it shows some on the bottom but I was
thinking that they would make it easier then that? I starred the
articles that I started to see them on the my posts link.

as far as the site its www.stoneorbone.com right now it works because
instead of calling the getImage function I just have it do a JS refresh
of the page.

Randy Webb wrote:
seanism said the following on 5/14/2006 8:50 PM:

Please quote what you are replying to.

If you want to post a followup via groups.google.com, don't use the
"Reply" link at the bottom of the article. Click on "show options" at
the top of the article, then click on the "Reply" at the bottom of the
article headers.

<URL: http://www.safalra.com/special/googlegroupsreply/ >
very true indeed.


Post a URL to a full sample page that displays the behavior and what
steps produce the error.
--
Randy
comp.lang.javascript FAQ - http://jibbering.com/faq & newsgroup weekly
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/


May 16 '06 #6
seanism said the following on 5/16/2006 2:10 PM:
rgr that Randy. Should I reply on the top or bottom of the quoted
information?
What do most in this group do and what does that FAQ/Notes say with
regards to that?

Hint: Pay attention to how my reply is done.
Also is there an easy way to see what threads you started?
For me, yes. But, I don't use Google Groups. Ask a Google Groups person.
If I goto my profile it shows some on the bottom but I was
thinking that they would make it easier then that? I starred the
articles that I started to see them on the my posts link.
<shrug> No idea as I don't use Google Groups.
as far as the site its www.stoneorbone.com right now it works because
instead of calling the getImage function I just have it do a JS refresh
of the page.


Well, you know the getImage() function works properly or you would get
errors when it gets triggered onload.

All of that code looks like a hard way to do something. What exactly is
it that you are trying to do with it? Let someone vote, post the vote,
then retrieve an image? But then you split that image and only use part
of it. Why not just have the PHP return the plain HTML code you want to use?

--
Randy
comp.lang.javascript FAQ - http://jibbering.com/faq & newsgroup weekly
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
May 16 '06 #7
seanism wrote:
var request = false;
`request' is used as an object reference. It should be initialized
with `null' (null reference), not the boolean value `false'.
try{
There is no need for try...catch for XMLHttpRequest, only for ActiveXObject.
In fact, using too much exception handling can prevent you from catching
your bugs.
// Mozilla/Safari
if (window.XMLHttpRequest)
You are feature-testing the mere _existence_ (to be more exact: the
_true-value_) of a property of _`window'_ ...
request = new XMLHttpRequest();
.... but you _construct_ with a _method_ of the _Global Object_.
Furthermore, you do not declare `request', and so it becomes a property of
the Global Object, /iff/ there is no other object in the scope chain where
this applies to. Both approaches are error-prone.
// IE
else if (window.ActiveXObject)
request = new ActiveXObject("Microsoft.XMLHTTP");
Same here.
}
catch (e) {
alert(e);
}
Your code style allows for improvement. For example, do not use tabs;
use spaces.
// Error

if(!request)
alert("XHR Object cannot create");


The content of those message boxes is useless to Joe User, so you better
make them debug messages only.

var _global = this;

function isMethod(a)
{
return a && /\b(function|object)\b/.test(typeof a);
}

function getImage()
{
var request = null;

if (isMethod(_global.XMLHttpRequest))
{
request = new XMLHttpRequest();
}
else if (isMethod(_global.ActiveXObject))
{
try
{
request = new ActiveXObject("Microsoft.XMLHTTP");
}
catch (e)
{
// ...
}
}

if (request)
{
// ...
}
else
{
// ...
}

return request;
}
PointedEars
--
This above all: To thine own self be true.
-- William Shakespeare (1564-1616)
May 22 '06 #8
seanism wrote:
Error: [Exception... "Component returned failure code: 0xc1f30001
(NS_ERROR_NOT_INITIALIZED) [nsIXMLHttpRequest.send]" nsresult:
"0xc1f30001 (NS_ERROR_NOT_INITIALIZED)" location: "JS frame :: mysite
:: getImage :: line 37" data: no]
Source File: mysite
Line: 37


First Google hit for this error code:

<URL:http://www.quirksmode.org/blog/archives/2005/09/xmlhttp_notes_a_1.html>
PointedEars
May 22 '06 #9
Thomas 'PointedEars' Lahn said the following on 5/22/2006 11:26 AM:
seanism wrote:
var request = false;
`request' is used as an object reference. It should be initialized
with `null' (null reference), not the boolean value `false'.


Either one satisfies the requirements of the test that is used on it.
try{


There is no need for try...catch for XMLHttpRequest, only for ActiveXObject.
In fact, using too much exception handling can prevent you from catching
your bugs.


Absolutely.
// Mozilla/Safari
if (window.XMLHttpRequest)


You are feature-testing the mere _existence_ (to be more exact: the
_true-value_) of a property of _`window'_ ...
request = new XMLHttpRequest();


.... but you _construct_ with a _method_ of the _Global Object_.


So what?
Furthermore, you do not declare `request', and so it becomes a property of
the Global Object, /iff/ there is no other object in the scope chain where
this applies to. Both approaches are error-prone.
Now, once again, please name a browser that does not implement the
window as the Global Object. And especially a browser that supports
window.XMLHttpRequest where window isn't the Global Object.

Your ranting about window not being the Global Object gets old.
Your code style allows for improvement. For example, do not use tabs;
use spaces.
There are problems with the posting style, but the coding style is
perfectly acceptable. Code any way you want, just pretty it up to post
it to Usenet.
// Error

if(!request)
alert("XHR Object cannot create");


The content of those message boxes is useless to Joe User, so you better
make them debug messages only.

var _global = this;


Unneeded Global Variable.
function isMethod(a)
{
return a && /\b(function|object)\b/.test(typeof a);
}

function getImage()
{
var request = null;

if (isMethod(_global.XMLHttpRequest))
Nonsense test.
{
request = new XMLHttpRequest();
}
else if (isMethod(_global.ActiveXObject))


Nonsense test.

But, once again, nothing you posted had anything to do with the problem.

--
Randy
comp.lang.javascript FAQ - http://jibbering.com/faq & newsgroup weekly
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
May 22 '06 #10
I wrote a blog post about this error. Basically, the error means that you are trying to use a request object that is already being used or is busy. I could be wrong but I made a work-around: created a second request object if the first is busy.

Error post: http://blog.petewood.us/2006/05/19/n...-ajax-enabled/

Error fix post:
http://blog.petewood.us/2006/05/23/u...s-posts-error/

Hope this helps...if you haven't figured out a solution already.
Jul 10 '06 #11

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

Similar topics

2
by: Simon Wigzell | last post by:
Can I turn off that annoying little box with the save/print/send etc. icons in it that IE pops up whenever I mouseover a picture in my browser? I mean in my own web pages is there something I can...
2
by: TeknoCat | last post by:
Hey everyone, I may be repeating myself here, but if someone sent a reply then I missed it, and I can't get Outlook Express to download any messages more than 2 days old. Anyway, I'm having a...
10
by: Douglas Buchanan | last post by:
I am using the following code instead of a very lengthly select case statement. (I have a lot of lookup tables in a settings form that are selected from a ListBox. The data adapters are given a...
3
by: bill | last post by:
There's a page that I frequently need to use, but I find that I cannot bookmark it, because it starts with if (parent.location.href == self.location.href) { // change the url below to the url of...
6
by: mark | r | last post by:
how do i automatically trigger functions like displaydate() in SP2 without getting that annoying security error. i use things like these almost every time on sites (see www.sicl.co.uk for my...
15
by: 50295 | last post by:
Hi everyone, This one is better experienced than explained, so I'm including a code sample below. Please and save (as an html file) and view with NN or Firefox (or maybe even Mozilla), and then...
2
by: horos | last post by:
just another thing.. for people who are trying to replace a url outside of a form and who are searching for an answer - when you are trying to use the document.location.replace("") method for going...
2
by: Vijay Kerji | last post by:
Hi, Please go through the following scenario. 1)On Button click, Parent window opens a child window using showModalDialog 2)Button is a server control and showModalDialog script is registered...
5
by: nospam | last post by:
I think there is a flaw/bug in ASP.NET or IIS. I try to test my pages in Firefox Browser because it's better than IE (page source coloring, tabbed browsing, etc.) but the JavaScript that is...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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
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...
0
agi2029
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,...
0
isladogs
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...

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.