TalkPHP

TalkPHP (http://www.talkphp.com/forums.php)
-   Javascript, AJAX, E4X (http://www.talkphp.com/javascript-ajax-e4x/)
-   -   uncaught exception: [Exception... "Component returned failure code: 0xc1f30001 (NS_ER (http://www.talkphp.com/javascript-ajax-e4x/2338-uncaught-exception-exception-component-returned-failure-code-0xc1f30001-ns_er.html)

Orc 02-26-2008 01:36 PM

uncaught exception: [Exception... "Component returned failure code: 0xc1f30001 (NS_ER
 
Code:

uncaught exception: [Exception... "Component returned failure code: 0xc1f30001 (NS_ERROR_NOT_INITIALIZED) [nsIXMLHttpRequest.send]" nsresult: "0xc1f30001 (NS_ERROR_NOT_INITIALIZED)" location: "JS frame ::
What does this mean? heres my code:
Code:


<script type="text/javascript">

 try {
 xmlHttp = new ActiveXObject('MSXML2.XMLHTTP');
 } catch(e)
 {
 
}
try {
 xmlHttp = new ActiveXObject('Microsoft.XMLHTTP');
} catch(e) {
  alert("Your Browser doesnt support AJAX");
}

try {
xmlHttp = new XMLHttpRequest();
} catch(e) {
 alert("AJAX n0t supported");
}



function Asx()
{
 xmlHttp.send("GET", "a.php", true);
 xmlHttp.open();
 var msg = document.getElementById('msg');

 xmlHttp.openReadyStateChange = responseAsx();
}

function responseAsx()
{
 msg.innerHTML = xmlHttp.responseText;

 if (xmlHttp.readyState == 4 )
 {
  msg.innerHTML = "Worked!";
 } else if (xmlHttp.readyState != 4 )
{
 document.write('Loading..');
 }
}


SOCK 02-26-2008 02:07 PM

You've confused / swapped the 'open' and 'send' methods. You should be using
Code:

xmlHttp.open("GET", "a.php", true);
xmlHttp.onreadystatechange= responseAsx;
xmlHttp.send(void);

You're also not using the responseAsx callback function correctly; notice how I've altered the code to use the name of the callback, not act as if it were a function call.

Wikipedia.org :: XMLHttpRequest

Orc 02-26-2008 02:12 PM

Quote:

Originally Posted by SOCK (Post 11443)
You've confused / swapped the 'open' and 'send' methods. You should be using
Code:

xmlHttp.open("GET", "a.php", true);
xmlHttp.onreadystatechange= responseAsx;
xmlHttp.send(void);

You're also not using the responseAsx callback function correctly; notice how I've altered the code to use the name of the callback, not act as if it were a function call.

Wikipedia.org :: XMLHttpRequest

Now I get
Code:

Element referenced by ID/NAME in the global scope. Use W3C standard document.getElementById() instead.
[Break on this error] undefined
test.html (line 34)
msg is not defined
[Break on this error] msg.innerHTML = xmlHttp.responseText;
test.html (line 34)
msg is not defined
[Break on this error] msg.innerHTML = xmlHttp.responseText;

:(, AJAX is harder than php. :P

More and More errors:
Code:

Element referenced by ID/NAME in the global scope. Use W3C standard document.getElementById() instead.
[Break on this error] undefined
test.html (line 34)
msg is not defined
[Break on this error] msg.innerHTML = xmlHttp.responseText;
test.html (line 34)
msg is not defined
[Break on this error] msg.innerHTML = xmlHttp.responseText;
test.html (line 34)
uncaught exception: [Exception... "Not enough arguments" nsresult: "0x80570001 (NS_ERROR_XPC_NOT_ENOUGH_ARGS)" location: "JS frame :: /test.html :: Asx :: line 29" data: no]
[Break on this error] undefined
Element referenced by ID/NAME in the global scope. Use W3C standard document.getElementById() instead.
[Break on this error] undefined
test.html (line 34)
Element referenced by ID/NAME in the global scope. Use W3C standard document.getElementById() instead.
[Break on this error] undefined
test.html (line 38)
uncaught exception: [Exception... "Not enough arguments" nsresult: "0x80570001 (NS_ERROR_XPC_NOT_ENOUGH_ARGS)" location: "JS frame :: /test.html :: Asx :: line 29" data: no]
[Break on this error] undefined
uncaught exception: [Exception... "Not enough arguments" nsresult: "0x80570001 (NS_ERROR_XPC_NOT_ENOUGH_ARGS)" location: "JS frame :: /test.html :: Asx :: line 29" data: no]
[Break on this error] undefined
Element referenced by ID/NAME in the global scope. Use W3C standard document.getElementById() instead.
[Break on this error] undefined
test.html (line 34)
Element referenced by ID/NAME in the global scope. Use W3C standard document.getElementById() instead.
[Break on this error] undefined
test.html (line 38)
uncaught exception: [Exception... "Not enough arguments" nsresult: "0x80570001 (NS_ERROR_XPC_NOT_ENOUGH_ARGS)" location: "JS frame :: /test.html :: Asx :: line 29" data: no]
[Break on this error] undefined
uncaught exception: [Exception... "Not enough arguments" nsresult: "0x80570001 (NS_ERROR_XPC_NOT_ENOUGH_ARGS)" location: "JS frame :: /test.html :: Asx :: line 29" data: no]
[Break on this error] undefined
uncaught exception: [Exception... "Not enough arguments" nsresult: "0x80570001 (NS_ERROR_XPC_NOT_ENOUGH_ARGS)" location: "JS frame :: /test.html :: Asx :: line 29" data: no]
[Break on this error] undefined
Element referenced by ID/NAME in the global scope. Use W3C standard document.getElementById() instead.
[Break on this error] undefined
test.html (line 34)
Element referenced by ID/NAME in the global scope. Use W3C standard document.getElementById() instead.
[Break on this error] undefined
test.html (line 38)
uncaught exception: [Exception... "Not enough arguments" nsresult: "0x80570001 (NS_ERROR_XPC_NOT_ENOUGH_ARGS)" location: "JS frame :: /test.html :: Asx :: line 29" data: no]
[Break on this error] undefined
uncaught exception: [Exception... "Not enough arguments" nsresult: "0x80570001 (NS_ERROR_XPC_NOT_ENOUGH_ARGS)" location: "JS frame :: /test.html :: Asx :: line 29" data: no]
[Break on this error] undefined
Element referenced by ID/NAME in the global scope. Use W3C standard document.getElementById() instead.
[Break on this error] undefined
test.html (line 34)
Element referenced by ID/NAME in the global scope. Use W3C standard document.getElementById() instead.
[Break on this error] undefined
test.html (line 38)
uncaught exception: [Exception... "Not enough arguments" nsresult: "0x80570001 (NS_ERROR_XPC_NOT_ENOUGH_ARGS)" location: "JS frame :: /test.html :: Asx :: line 29" data: no]



All times are GMT. The time now is 02:50 AM.

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0