Useses Of XMLHttpRequest

I want to know about XMLHttpRequest and for what purpose it should be used. What are the benefits of it.

View Replies


ADVERTISEMENT

XmlhttpRequest Caching

We are having a problem with a xmlhttpRequest request returning a cached version of the request - the code we are using is inserted below. Has anyone else had this problem before - or have any ideas on what we may be doing incorrectly.

xmlhttpRequest : function(url)
{
var mainPageURL = document.location.href.split("/");
var xmlhttp = new ActiveXObject("MSXML2.XMLHTTP.3.0");
try
{
var vURL = mainPageURL[0] + "//" + mainPageURL[2] + "/" +
mainPageURL[3] + "/" + url;
xmlhttp.open("GET", vURL, false);
xmlhttp.send();
if (xmlhttp.statustext != "OK")
{
alert("Failed to execute URL " + vURL + ": " +
xmlhttp.statusText);
return "";
}
else
return xmlhttp.responseText;
}
finally
{
xmlhttp = null;
}
},


--
jmt

View Replies View Related

Passing Data Via XMLHTTPRequest

I've been doing some reading about "AJAX" and it sounds pretty interesting.
While I can make it work, it seem like I'm doing much of it the "hard way".
I was wondering what kind of code that others use to pass data via
XMLHTTPRequest.

My code is usually in ASP, with VBScript or Javascript for the client side
of things. I've done a bit of PHP as well. Definately not an expert by any
means, but I do understand programming - I just don't know what
elements/objects/methods/etc. are available.

So, consider the following and tell me what you'd do. Sample code is great
as well.

Address book type web application, but page contains info from two seperate
queries. User enters a name in one area of the page and clicks Search. The
XMLHTTPRequest object hits an ASP page and populates the related fields
(Name, age, SIN, etc.) in the clients screen, keeping other elements in the
page intact. What if the returned data contained a binary, like a photo?

Would you have the ASP page return a simple HTML document and parse out the
"responseText" property to find your field data? How about having the ASP
page generate a XML response and using the "responseXML" property as an
"object" containing the required information?

I guess I'm just trying to get my head around how I'd be passing different
types of information from my server side page using the XMLHTTPRequest
object. It seems like such a simple thing, but looks much more complicated
in any samples that I can find.

View Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved