I'm new to JavaScript and this is annoying me. I have defined a "class"
(JavaScript OO seems really strange to me...) in the following way:
function StateSuggestions(pSource) {
this.source = pSource;
this.req=new ActiveXObject("Msxml2.XMLHTTP"); //this.req != null
this.Process = MyProcess;
this.requestSuggestions = MyRequestSuggestions;
....
//requestSuggestions is called from Outside
function MyRequestSuggestions(pAutoSuggestControl, pTypeAhead) {
this.req.onreadystatechange = this.Process; //this.req !=
null
this.req.open("GET",url, true);
....
function MyProcess (){
this.aSuggestions = [];
if (this.req!=null){ //this.req ==
null......why??????
if (this.req.readyState == 4){
if (this.req.status == 200){
....
All seems to work fine, except that this.req is null when MyProcess is
reached...
When creating the object this.req != null, in MyRequestSuggestions
this.req != null, but when MyProcess is reached, this.req turns to null
Best Regards
Fabio Cavassini