By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
462,047 Members | 607 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 462,047 IT Pros & Developers. It's quick & easy.

xmlHttp.responseXML returns nothing

P: 2
i went thru a discussion put by eros and helped out by dmjpros.
d questions asked were right and i tried each but there was no problem there.
my code returns null in xmlHttp.responseXML and xmlHttp.responseText returns nothing.

My Code:

Expand|Select|Wrap|Line Numbers
  1. function commoPrice()
  2.     {
  3.         var cid = document.kerala.commodities.value;
  4.         if(cid ==0)
  5.         {
  6.             alert("Select a Commodity");
  7.             document.kerala.commodities.focus();
  8.         }
  9.         else
  10.         {
  11.             url = "http://gistest/servlet/DispCommo?cid="+cid;
  12.             xmlHttp = initRequest();
  13.             xmlHttp.onreadystatechange = dispCommoPrice;
  14.             xmlHttp.open("GET",url,true);
  15.             xmlHttp.send(null);
  16.         }
  17.     }
  18.  
  19.     function dispCommoPrice()
  20.     {
  21.         var i=0;
  22.         var count=0;
  23.         var xmlDoc = xmlHttp.responseXML;
  24.         alert(xmlHttp.responseXML);
  25.         alert(xmlHttp.responseText);
  26.         var value = xmlDoc.getElementsByTagName("root")[0];
  27.         alert("Value "+value);
  28.         count = value.childNodes.length;
  29.         alert("count "+count);
  30.  
  31.         for(i=0;i<count;i++)
  32.         {
  33.             t.price[i] = xmlDoc.getElementsByTagName("price")[i].childNodes[0].nodeValue;
  34.             alert("price "+i+" "+xmlDoc.getElementsByTagName("price")[i].childNodes[0].nodeValue);
  35.         }
  36.         if(xmlHttp.readyState == 4)
  37.         {
  38.             if(xmlHttp.status = 200)
  39.             {
  40.                 alert("status OK!");
  41.             }
  42.         }
  43.     }
the status and readystate values are coming right.but i cant figure out what the problem is!

PLZ HELP!!!!
Sep 12 '07 #1
Share this Question
Share on Google+
1 Reply

acoder
Expert Mod 15k+
P: 16,027
Please use code tags when posting code.

Check for the readyState and status before attempting to get the response.
Sep 12 '07 #2

Post your reply

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