W
Wescotte
I've wrote a little test app to use XMLHTTPRquest test app but I'm
looking to add some functionality and I'm not quite so how to go about
doing it.
Below is the source
What I'd really like is to be able to use <SPAN onClick =
"Select(this);">
where I could pass the object and not have to display the results of
the XMLHTTPRequest via a getElementById(). Any ideas how I can create
the ability to pass an object ot the onreadystatechange function?
<HTML> <HEAD>
<script type="text/javascript">
function Request_URL(url)
{
// code for Mozilla, etc.
if (window.XMLHttpRequest) {
xmlhttp=new XMLHttpRequest();
xmlhttp.onreadystatechange=processStateChange;
xmlhttp.open("GET",url,true);
xmlhttp.send(null);
}
// code for IE
else if (window.ActiveXObject) {
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP")
if (xmlhttp) {
xmlhttp.onreadystatechange=processStateChange;
xmlhttp.open("GET",url,true);
xmlhttp.send();
}
}
}
function processStateChange() {
// if xmlhttp shows "loaded"
if (xmlhttp.readyState==4) { // This means the request was sent and
the ENTIRE responce has been recieve (the whole page loaded)
if (xmlhttp.status==200) { // Check that the data was recieved
correctly
document.getElementById("T1").innerHTML=xmlhttp.responseText;
}
else {
alert("Problem retrieving XML data");
}
}
}
function Select()
{
var url = "HTTPRequest_file.html";
var temp=Request_URL(url);
}
</script>
</HEAD>
<BODY>
<SPAN id = "T1" onClick = "Select();">
Click on me to update my text from another webpage
</SPAN>
</BODY>
</HTML>
looking to add some functionality and I'm not quite so how to go about
doing it.
Below is the source
What I'd really like is to be able to use <SPAN onClick =
"Select(this);">
where I could pass the object and not have to display the results of
the XMLHTTPRequest via a getElementById(). Any ideas how I can create
the ability to pass an object ot the onreadystatechange function?
<HTML> <HEAD>
<script type="text/javascript">
function Request_URL(url)
{
// code for Mozilla, etc.
if (window.XMLHttpRequest) {
xmlhttp=new XMLHttpRequest();
xmlhttp.onreadystatechange=processStateChange;
xmlhttp.open("GET",url,true);
xmlhttp.send(null);
}
// code for IE
else if (window.ActiveXObject) {
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP")
if (xmlhttp) {
xmlhttp.onreadystatechange=processStateChange;
xmlhttp.open("GET",url,true);
xmlhttp.send();
}
}
}
function processStateChange() {
// if xmlhttp shows "loaded"
if (xmlhttp.readyState==4) { // This means the request was sent and
the ENTIRE responce has been recieve (the whole page loaded)
if (xmlhttp.status==200) { // Check that the data was recieved
correctly
document.getElementById("T1").innerHTML=xmlhttp.responseText;
}
else {
alert("Problem retrieving XML data");
}
}
}
function Select()
{
var url = "HTTPRequest_file.html";
var temp=Request_URL(url);
}
</script>
</HEAD>
<BODY>
<SPAN id = "T1" onClick = "Select();">
Click on me to update my text from another webpage
</SPAN>
</BODY>
</HTML>