473,385 Members | 1,907 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,385 software developers and data experts.

readyState is null or not an object error

Hi All,


I have to display the value in textbox that is selected from dropdownlistbox using ajax.i got the readyState is null or not an object error.

coding:
Expand|Select|Wrap|Line Numbers
  1.  <script language="javascript" type="text/javascript">
  2.  function GetDataViaAJAX()
  3. {
  4. var obj;
  5. try
  6. {
  7. obj = new ActiveXObject("Msxml2.XMLHTTP");
  8. }
  9. catch(e)
  10. {
  11. try
  12. {
  13. obj = new ActiveXObject("Microsoft.XMLHTTP");
  14. }
  15. catch(e1)
  16. {
  17. obj = null;
  18. }
  19. }
  20. if(obj!=null)
  21. {
  22. obj.onreadystatechange=stateChanged;
  23. obj.open("GET","ajaxex.aspx?client="+ document.getElementById("DropDownList1").value,true);
  24. obj.send(null);        
  25. }
  26. return false;
  27. }
  28.  
  29. function stateChanged() 
  30. var obj;
  31. if (obj.readyState == 4)
  32. var textclient=obj.responseText;
  33. alert(textclient);
  34. var textclientobj=document.getElementById("TextBox1");
  35. textclientobj.innerHTML=textclient;
  36.  
  37. }
  38. }
  39. </script>
  40.  
ajaximp.aspx.cs:
Expand|Select|Wrap|Line Numbers
  1. protected void Page_Load(object sender, EventArgs e)
  2.     {
  3.  
  4.         DropDownList1.Attributes.Add("onChange", "return GetDataViaAJAX();");
  5.         }     


Plz give me a solution.its urgent!!!!

Thaks
Krish
Oct 16 '07 #1
3 3967
kenobewan
4,871 Expert 4TB
Here is an article that may help:
AJAX for ASP.NET
Oct 16 '07 #2
Hello krishnagovindaraj,

I know it is too late reply. Since just now I come across your question and thought of helping you. To avoid your issue remove variable declaration for "obj" from onstate function and check.
Mar 31 '09 #3
Plater
7,872 Expert 4TB
Well this was a really simple answer, not sure why its being brought up
Of course readyState doesn't exist, obj is a null object in this instance
Expand|Select|Wrap|Line Numbers
  1. var obj; 
  2. if (obj.readyState == 4) 
  3. {  
  4.  
Remove the var obj; line and it should be fine
Apr 1 '09 #4

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

Similar topics

1
by: Michael J Whitmore | last post by:
I am getting tired of losing hair over this. Here is a function that simply inserts one of three images into a document right before printing. It is called for every element that has a specific...
9
by: Eric Wallstedt | last post by:
I have a page that "logs" changes made to input fields using ajax to pass data to a cgi. I use POST and it works fine most of the time (all the time in IE). But it fails when I get the data from...
2
by: coolvirus | last post by:
I'm using the XMLHTTPRequest JavaScript object to fetch updated info from the server. The problem I'm having occurs on Windows 2000/IE 6. There is a very long pause on readyState 3 (close to a...
0
by: Mathan Babu | last post by:
Hello, Once the AJAX request is fired the readystate property remain as 1. It never gets changed and the callback method is not firing as a result the ..aspx page is not being rendered. The...
2
by: Mark Knochen | last post by:
Hi, i have a little problem with ajax. The follow functions are in my site: function sndReq(ID,divID) { resObjekt.open('get','inc/inc_change_pagelogo.php?ID='+ID,true);...
1
by: iporter | last post by:
I have several functions with code along the lines of: var xmlDoc = requestXML("ajax.asp?SP=SelectRelatedTags&tag=" + array); The requestXML() function includes the code: var xmlDoc = null;...
5
by: KingdomHeart | last post by:
I recently try to learn Ajax. But my code never got pass the xmlhttp.readyState because it is always = to 1. My callback function is OnData and it is call when onreadystatechange set. Line 40 is...
13
by: dmorand | last post by:
I'm having a little trouble getting this ajax to work. Everytime I select a value in the page below I'm seeing that the readyState is 1, but never changes from 1. Here is my html: <div...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.