[Javascript] return value from "ajax"/ function

Michael Borchers list at tridemail.de
Fri Dec 8 04:38:07 CST 2006


function requestFile(url)
{
 httpRequest.open('get', url, true);
 httpRequest.onreadystatechange = function() { handleRequest() };
 httpRequest.send(null);
 }

...
var foo = requestFile(...);

the handleRequest() function gets the data and when it's ready loaded, and 
only then(!), requestFile() should return the data for the var foo.

how can I do this?! 




More information about the Javascript mailing list