<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html lang="en">
<head>
<title>rodsdot.com :: simulation of client communication with web service</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="author" content="Roderick Divilbiss">
<meta name="copyright" content="© 2005-2010 Roderick Divilbiss">
<script type="text/javascript">
var sending=false;
//create the Cross-browser XMLHttpRequest object
function getFile(pURL,pSend) {
alert('Sending a request to rodsdot.com for userid: '+pSend);
//if (!sending) {
if (window.XMLHttpRequest) { // code for Mozilla, Safari, etc
xmlhttp=new XMLHttpRequest();
if (xmlhttp.overrideMimeType) {
xmlhttp.overrideMimeType('text/xml');
}
xmlhttp.onreadystatechange=postFileReady;
xmlhttp.open("GET", pURL+'?userid='+pSend, true);
xmlhttp.send(null);
} else if (window.ActiveXObject) { //IE
xmlhttp=new ActiveXObject('Microsoft.XMLHTTP');
if (xmlhttp) {
xmlhttp.onreadystatechange=postFileReady;
xmlhttp.open('GET', pURL+'?userid='+pSend, false);
xmlhttp.send();
}
}
}
// function to handle asynchronus call
function postFileReady() {
if (xmlhttp.readyState==4) {
if (xmlhttp.status==200) {
document.getElementById('theExample').innerHTML=xmlhttp.responseText;
}
}
}
</script>
</head>
<body>
<div id="theExample">The web site messages will appear here...</div>
<p><select size="1" name="userid" id="userid">
<option>Select name to send</option>
<option value="rdivilbiss">rdivilbiss</option>
<option value="alangsk">alangsk</option>
<option value="joesmoe">joesmoe</option>
<option value="unknown">unknown</option>
</select>
<input type="button" value="Send Request" onclick="getFile('http://www.domain.com/page.asp',document.getElementById('userid')[document.getElementById('userid').selectedIndex].value)"</p>
</body>
</html>
Date Validation Using JavaScript .
Cross-Browser Clipboard Copy .
Loading Images With Remote Scripting .
Why JavaScript In Hyperlinks Is Bad .
Change The Submit Button To Show Waiting For AJAX Response .
European Date Validation Using JavaScript .
Database Results To Client Side Array .
Reading Files With JavaScript .
AJAX For Plain Text And HTML .