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

Java Script Error when using Ajax in php.

Hai,

I got an javascript error when using ajax in mozilla browser, 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)
Dec 20 '07 #1
7 2834
Hai,

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)
Dec 20 '07 #2
gits
5,390 Expert Mod 4TB
threads merged since they cover the same issue ... please don't double post your questions

kind regards
Dec 20 '07 #3
acoder
16,027 Expert Mod 8TB
Without posting code, we can only guess. Post your code.
Dec 22 '07 #4
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
-------------------

Expand|Select|Wrap|Line Numbers
  1. <script>
  2. function ddlClass1(val)
  3. {
  4.    if(val==0)
  5.    {
  6.         document.getElementById('divClass2').style.display='none';
  7.    }
  8.    if(val != 0)
  9.    {
  10.  
  11.         var http = createRequestObject();
  12.         http.open('GET','itemadd.php?id='+val);
  13.         http.onreadystatechange = function()
  14.         {
  15.             if(http.readyState == 4 && http.status  == 200)
  16.                 {
  17.  
  18.                 var response = http.responseText;
  19. //        alert(response);
  20.                 if(response)
  21.                  {
  22.  
  23.                     document.getElementById('divClass1').style.display='';
  24.                     document.getElementById('divClass2').style.display='none';
  25.                     document.getElementById("divClass1").innerHTML = response;
  26.  
  27.                  }
  28.                 }
  29.             else
  30.              {
  31.                 document.getElementById("divClass1").innerHTML="Error code " + http.status;
  32.              }
  33.             }
  34.  
  35.         http.send(null);
  36.  
  37.  
  38.     }
  39. }
  40.  
  41.  
  42.  
  43.     function createRequestObject()
  44.         {
  45.             var req;
  46.             try
  47.             {
  48.                     // Firefox, Opera 8.0+, Safari   
  49.                  req=new XMLHttpRequest();   
  50.             }
  51.           catch (e)
  52.             {   
  53.                  // Internet Explorer 
  54.                 try
  55.                     {
  56.                       req=new ActiveXObject("Msxml2.XMLHTTP");     
  57.                     }
  58.                 catch (e)
  59.                     {     
  60.                       try
  61.                           { 
  62.                             req=new ActiveXObject("Microsoft.XMLHTTP");       
  63.                           }
  64.                         catch (e)
  65.                           {      
  66.                              alert("Your browser does not support AJAX!"); 
  67.                              return false;     
  68.                           }  
  69.                     } 
  70.              }
  71.         return req;
  72.         }
  73.  
  74. </script>
  75.  
[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]

================================================== =================
Dec 24 '07 #5
acoder
16,027 Expert Mod 8TB
What line does this error occur on? I'm guessing it occurs on this line:
Expand|Select|Wrap|Line Numbers
  1. if(http.readyState == 4 && http.status  == 200)
Correct?

Please use code tags when posting code.
Dec 24 '07 #6
What line does this error occur on? I'm guessing it occurs on this line:
Expand|Select|Wrap|Line Numbers
  1. if(http.readyState == 4 && http.status  == 200)
Correct?

Please use code tags when posting code.


Sorry for the late reply


The component return failure error is coming in the javascript of line is 32

Expand|Select|Wrap|Line Numbers
  1.       <script>
  2.       function ddlClass1(val)
  3.       {
  4.          if(val==0)
  5.          {
  6.               document.getElementById('divClass2').style.display  ='none';
  7.          }
  8.          if(val != 0)
  9.          {
  10.  
  11.               var http = createRequestObject();
  12.               http.open('GET','itemadd.php?id='+val);
  13.               http.onreadystatechange = function()
  14.               {
  15.                   if(http.readyState == 4 && http.status  == 200)
  16.                       {
  17.  
  18.                       var response = http.responseText;
  19.       //    alert(response);
  20.                       if(response)
  21.                        {
  22.  
  23.                           document.getElementById('divClass1').style.display  ='';
  24.                           document.getElementById('divClass2').style.display  ='none';
  25.                           document.getElementById("divClass1").innerHTML = response;
  26.  
  27.                        }
  28.                       }
  29.                   else
  30.                    {
  31.                       document.getElementById("divClass1").innerHTML="Error code " + http.status;
  32.                    }
  33.                   }
  34.  
  35.               http.send(null);
  36.  
  37.  
  38.           }
  39.       }
  40.  
Mar 19 '08 #7
acoder
16,027 Expert Mod 8TB
See if this thread from the archives helps.

Note that to use code tags, you just need to wrap them using the # button, e.g.
[code=javascript]your code here[/code]
Mar 19 '08 #8

Sign in to post your reply or Sign up for a free account.

Similar topics

5
by: TZESENG | last post by:
DECEMBER 13, 2005 . Editions: N. America | Europe | Asia | Edition Preference News Analysis By Steve Hamm Source: http://www.businessweek.com/technology/content/dec2005/tc20051213_042973.htm...
1
by: pdesai007 | last post by:
hello, i tried to upload an image in to server with asp and java script ( using AJAX) but it gave an error. so please give me any solution that help me to upload an image to server with java...
5
by: camphor | last post by:
hi, I have found an upload script in hotscripts and have implemented it into the website, I followed the installation steps to 'give write permissions to php on the upload folder (which is...
2
by: =?Utf-8?B?REo=?= | last post by:
I have a peculiar problem here that I did not have until I migrated from ASP.NET 2.0 to 3.5. I use a master page for my application. Because the master page uses update panels I have the...
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...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
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.