the code my brother wrote worked before but i think i changed him by mistake maybe you can see why he wont return the XML data.
function CheckFromTo(From,To)
{
//alert(From + "," + To);
var xmlHttp = null;
var Url = "http://www.fpl.co.il/bo/info/CheckFromTo.aspx?FROM=" + From + "&TO=" + To + "";
xmlHttp = new XMLHttpRequest();
xmlHttp.onreadystatechange = ProcessRequest;
xmlHttp.open( "GET", Url, true );
xmlHttp.send(null);
return (ProcessRequest());
function ProcessRequest()
{
if ( xmlHttp.readyState == 4 && xmlHttp.status == 200 )
{
var response = xmlHttp.responseText;
return response;
}
}
}
Look at your XMLHttprequest object
The true boolean in the open method means you are using a asynchronous call, that means you can not return a value. Welcome to asynchronous programming.
Why does it return undefined?
What happens in ProcessRequest when the stats is not 200 and the readystate is not 4? Nothing, it returns nothing, hence undefined.
You need to use a callback function when working with asynchronous calls. That means breaking up your logic into multiple steps.