...

View Full Version : Returning Data To A Class Property



Elcid32
07-26-2006, 04:30 PM
Hello Forum:

I am new to JavaScript and the AJAX technique and at this point I am exploring and learning. I would like to submit for your review the following code snippet:



function vmClass_loadData(){
var url = 'dataload.php';
var http = getHTTPObject();
http.onreadystatechange=function(){
if(http.readystate==4 && http.status==200){

//this assignment will not work
this.result = http.responseText;

}
}
http.open('GET',url,true);
http.send(null);
}


function vmClass(){
this.result = "";
this.loadData = vmClass_loadData;
this.loadData();
}


Now I realize this this code will not work; however, I do not quite understand why. I need a way to return data back to a class property but I can't, for the life of me, figure out how. I would appreciate any input. Thanks.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum