Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Web and WebWorks Development

Reply
New Developer
Posts: 10
Registered: ‎10-20-2009
My Device: Not Specified

AJAX onreadystatechange function problem

Hi all,

First of all, everything is working well in my PC. The problem happens when I test the application on the Blackberry 9000 simulator (version 4.6.0.20090409...). In the onchange action of a HTML <select> field, I have assigned a jsp file to the url of the XMLHttpRequest object. In the Tomcat server logger, AJAX is working wonderful, it connects to the server, make a DB query and returns the data as String (out.println(data)Smiley Wink. The problem:

in onreadystatechange, I have used the following:

 

xmlhttpreq.onreadystatechange = function(event) {
   alert("lfkgl");
   if (xmlhttpreq.readyState == 4) {
     alert(xmlhttpreq.responseText);	
   }
};

 as stated in: Using AJAX to ...

But neither alert is displayed... which means that this event (readyState) was not catched and dispatched! despite of that JavaScript is disabled and the 1st half part of AJAX is working.

 

I am a little bit confused about the fully support of AJAX, and in general JavaScript itself! for example: HTML <select> property "disabled" is not working in the simulator broswer. Is it a problem of the simulator only and if I used a real Blackberry device this the problem won't occur?

 

Thanks for any help that will save me a lot a lot of time!

mm

Highlighted
Developer
Posts: 395
Registered: ‎12-18-2008
My Device: BlackBerry Torch 9800
My Carrier: AT&T

Re: AJAX onreadystatechange function problem

Did you check to make sure that JavaScript is turned on in the browser?