Dear All,
Can anybody tell me the difference between
XHTTP and the usual http?
What is the difference between the
following two codes?? Which is better and preferred??
In both the cases I am sending a request
from the client to the server and the server returns an XML doc. The XML Doc is
a dynamic Doc created by a ASPX page.
Code 1. Here a HTTP Request is sent from the Client to the Server
and loads a XML Dom. This is then used to populate data into a ComboBox..
oXml = new
ActiveXObject("Microsoft.XMLDOM");
oXml.async = true;
try
{
window.document.focus();
oXml.load("ABC.aspx?Querystring=S”);
oXml.onreadystatechange =
funPopulateSel;
}
catch(e)
{
alert(e);
}
Code 2. Here is another code where in an xhttp
request is sent from client to server. The response is loaded in to a XML Dom
and is used to populate data into a combo box.
url="ABC.aspx?Querystring=S”
xmlhttp.open("GET",url,true);
xmlhttp.onreadystatechange=function()
{
if
(xmlhttp.readyState==4)
{
oXml
= new ActiveXObject("Microsoft.XMLDOM");
oXml.load(xmlhttp.responseText);
oXml.onreadystatechange =
funPopulateSel;
}
Which is better??
I prefer the first one because only one
object is created J…
The second case is how a typical AJAX works…may be
the response is not an XML.
Thanks And With Regards,
Anil R.Nair