Without posting code, we can only guess. Post your code.
I got a javascript error when using ajax with php, in mozilla browser, functionality wise it works properly. but i get this error, anyone help me why the error is coming, meaning for this error and how can i rectify this error.
Error: [Exception... "Component returned failure code: 0x80040111 (NS_ERROR_NOT_AVAILABLE) [nsIXMLHttpRequest.status]" nsresult: "0x80040111 (NS_ERROR_NOT_AVAILABLE)" location: "JS frame :: (here url)
In code "divClass2" is another drop down, this is also, i am getting using ajax.
i am getting the same error in this ajax code also.
Here is the codes
~~~~~~~~~~~~~
itemlist.php
-------------------
- <script>
-
function ddlClass1(val)
-
{
-
if(val==0)
-
{
-
document.getElementById('divClass2').style.display='none';
-
}
-
if(val != 0)
-
{
-
-
var http = createRequestObject();
-
http.open('GET','itemadd.php?id='+val);
-
http.onreadystatechange = function()
-
{
-
if(http.readyState == 4 && http.status == 200)
-
{
-
-
var response = http.responseText;
-
// alert(response);
-
if(response)
-
{
-
-
document.getElementById('divClass1').style.display='';
-
document.getElementById('divClass2').style.display='none';
-
document.getElementById("divClass1").innerHTML = response;
-
-
}
-
}
-
else
-
{
-
document.getElementById("divClass1").innerHTML="Error code " + http.status;
-
}
-
}
-
-
http.send(null);
-
-
-
}
-
}
-
-
-
-
function createRequestObject()
-
{
-
var req;
-
try
-
{
-
// Firefox, Opera 8.0+, Safari
-
req=new XMLHttpRequest();
-
}
-
catch (e)
-
{
-
// Internet Explorer
-
try
-
{
-
req=new ActiveXObject("Msxml2.XMLHTTP");
-
}
-
catch (e)
-
{
-
try
-
{
-
req=new ActiveXObject("Microsoft.XMLHTTP");
-
}
-
catch (e)
-
{
-
alert("Your browser does not support AJAX!");
-
return false;
-
}
-
}
-
}
-
return req;
-
}
-
-
</script>
-
[HTML]<form >
<table>
<tr class="text1">
<td>Items Add </td>
<td>
<select name="type123" class="txtfield" OnChange="ddlClass1(this.value)">
<option value="0">--Select Item--</option>
<?
include "dbconnect.inc";
$retsql="select * from itemmaster";
$exect=mysql_query($retsql);
while( $row=mysql_fetch_row($exect))
{
$id=$row[0];
$name=stripslashes($row[1]);
echo "<option value=\"$id\">$name</option>";
}
mysql_close();
?>
</select><br />
<div id="divofclass1" style="display:none"></div>
<div id="divClass1" style="display:none" ></div>
<div id="divClass2" style="display:none" ></div>
</td></tr>
</table></form>
[/HTML]================================================== =================
itemadd.php (AJAX)
------------------------------
[PHP]<?
include "dbconnect.inc";
$sqltypeitem="select count(*) from itemmaster where typeid=$id and typename='other'";
$exectype=mysql_query($sqltypeitem) or die("invalid query123" .mysql_error());
$countnumber=mysql_result($exectype,0,"count(*)");
if ($countnumber!=1)
{
$sqlcount = "select count(*) from itemsubmaster where itemid=$id";
$resultcount = mysql_query($sqlcount);
$count1=mysql_result($resultcount,0,"count(*)");
if ($count1!=0)
{
?>
[/PHP][HTML] <select name="subtype123" class="txtfield" onchange="ddlClass2(this.value)">
<option value="0">--Select Sub Item --</option>[/HTML]
[PHP] <?
$retsql="select * from itemsubmaster where itemid=$id";
$exect=mysql_query($retsql);
while( $row=mysql_fetch_row($exect))
{
$id=$row[0];
$name=stripslashes($row[2]);
echo "<option value=\"$id\">$name</option>";
}
?>
</select>
<? }
else {
?>
[/PHP][HTML] <script>
document.getElementById('divClass1').style.display ='';
document.getElementById('divClass2').style.display ='';
</script>[/HTML]
[PHP]<? }
}
else {
?>
[/PHP][HTML] <input type="text" class="txtfield" name="otherof" onblur="othervalueof(this.value)" >
<script>
document.getElementById('divofclass1').style.displ ay='';
document.getElementById('divClass1').style.display ='none';
document.getElementById('divClass2').style.display ='none';
</script>[/HTML]
[PHP]<?
}
mysql_close();
?>[/PHP]
================================================== =================