Hi all,

I'm trying to make a wrapper for the XMLHttp object (ajax). Here's my function to make an ajax call:
Code:
function ajaxCall(url)
{
  xmlHttp = getXmlHttObj();
  xmlHttp.open(url)
}

//usage
var HTML = ajaxCall(...);
//HTML of the page called is now in HTML var
Obviously this won't work because my ajaxCall function does not return a value. But that's what I want.

When firing open() as you know the responseText is returned in the stateChanged function, but how can I get it back to my original function, and return it into the HTML var?

Is it possible?

If not, can I pass a function as an argument to a function such as:
Code:
function ajaxCall(url, processHTML)
{
//call ajax, when got data - pass it to the processHTML callback
}

function processHTML(data)
{
  //got the data returned, in data var
}
Cheers