I am confused right now, and there will be test about ajax tommorrow..

And i bumped into this getXMLHTTP() function in one of the code that my professor gave me and i not sure what it does exactly.I mean because i also see in the other code, that people are using getXMLHttpRequest() in their ajax code and this make me more confused.

I have tried finding it on the net but theres no one yet given explanation on this. So i hope someone could give me explanation on this.

By the way, below this is the example of code that using this function :

function getInfo(strURL)
{		
	var req = getXMLHTTP();		
	if (req) 
	{
		req.onreadystatechange = function()
		{
			if (req.readyState == 4) 
			{			
				if (req.status == 200)
				{						
					document.getElementById("lect").innerHTML=req.responseText;						
				} 
				else 
				{
					alert("There was a problem while using XMLHTTP:\n" + req.statusText);
				}
			}				
		 }			
		 req.open("GET", strURL , true);
		 req.send(null);
	}			
}

thank you in advance :)

oouh2...i am so sorry...
actually getXMLHTTP() is the function that being made...
haha..sory for this...
anyway thanks :)

The XMLHTTP object is the core of AJAX functionality. It's essentially a way to call a web page roundtrip from within code. Depending on your browser, the exact syntax to call the XMLHTTP object differs. It might be as simple as:

new XMLHttpRequest

Or you might need to use an ActiveX object:

new ActiveXObject("Microsoft.XMLHTTP")

What's common in script is to declare a function that has try/catch blocks for the various ways of instantiating the XMLHTTP object, and most sample code out there defines that function as getXMLHTTP().

So in your code snippet, we see a function named getXMLHTTP() called, but we don't see that function actually defined.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.