D
Dennis van Weelden
Dear readers,
The purpose of the code which I have written is to show a special message
when you click on a paragraph. Unfortunately the code does give the
following error (in Firefox):
Fout: [Exception... "Component returned failure code: 0x80040111
(NS_ERROR_NOT_AVAILABLE) [nsIXMLHttpRequest.status]" nsresult: "0x80040111
(NS_ERROR_NOT_AVAILABLE)" location: "JS frame ::
http://localhost/oe/oe_211.html :: anonymous :: line 10" data: no]
Bronbestand: http://localhost/oe/oe_211.html
Regel: 10
BTW: regel 10 is dutch for line 10 which is the line with if (request.status
== 200).
The strange thing is that the AJAX works well (i get the message), but in
Firefox and in Internet Explorer I get error codes.
I have the following code:
oe_211.html:
<html>
<head>
<title></title>
<script type="text/javascript">
function makeRequest()
{
var request=new XMLHttpRequest();
request.open("GET","oe_212.php");
request.onreadystatechange=function() {
if (request.status == 200)
{
if (request.readyState == 4)
{
var obj=document.getElementById("content");
obj.childNodes[0].data=request.responseText;
}
else
{
// nothing
}
}
else
{
// nothing
}
}
request.send(null);
}
</script>
</head>
<body>
<p id="trigger">Click here</p>
<p id="content">!!!</p>
<script type="text/javascript">
triggerObj=document.getElementById("trigger");
triggerObj.addEventListener("click",makeRequest,false);
</script>
</body>
</html>
and the following code:
oe_212.php:
<?php
echo "Hello world!";
?>
What can be the problem?
With kind regards,
Dennis
The purpose of the code which I have written is to show a special message
when you click on a paragraph. Unfortunately the code does give the
following error (in Firefox):
Fout: [Exception... "Component returned failure code: 0x80040111
(NS_ERROR_NOT_AVAILABLE) [nsIXMLHttpRequest.status]" nsresult: "0x80040111
(NS_ERROR_NOT_AVAILABLE)" location: "JS frame ::
http://localhost/oe/oe_211.html :: anonymous :: line 10" data: no]
Bronbestand: http://localhost/oe/oe_211.html
Regel: 10
BTW: regel 10 is dutch for line 10 which is the line with if (request.status
== 200).
The strange thing is that the AJAX works well (i get the message), but in
Firefox and in Internet Explorer I get error codes.
I have the following code:
oe_211.html:
<html>
<head>
<title></title>
<script type="text/javascript">
function makeRequest()
{
var request=new XMLHttpRequest();
request.open("GET","oe_212.php");
request.onreadystatechange=function() {
if (request.status == 200)
{
if (request.readyState == 4)
{
var obj=document.getElementById("content");
obj.childNodes[0].data=request.responseText;
}
else
{
// nothing
}
}
else
{
// nothing
}
}
request.send(null);
}
</script>
</head>
<body>
<p id="trigger">Click here</p>
<p id="content">!!!</p>
<script type="text/javascript">
triggerObj=document.getElementById("trigger");
triggerObj.addEventListener("click",makeRequest,false);
</script>
</body>
</html>
and the following code:
oe_212.php:
<?php
echo "Hello world!";
?>
What can be the problem?
With kind regards,
Dennis